What is the purpose of ANYSIZE_ARRAY in <winnt.h>?

What is the purpose ANYSIZE_ARRAYlocated in WinNT.h?

I have been seeing the MSDN blog post about this since 2004, but that doesn't make sense to me.

+5
source share
2 answers

I assume you are talking about this blog post .

It is often used when a variable-size array (unknown at compile time) is part of the structure:

typedef struct {
    int CommonFlags
    int CountOfThings;
    THING Things[ANYSIZE_ARRAY]; //Things[1];
} THINGSANDFLAGS;

To work with these structures, you often first call the required API to get the size of the data, then allocate a memory block large enough and finally call the same API again so that it can fill the data ...

+5
source

From this page :

C a[1] a[ANYSIZE_ARRAY], ANYSIZE_ARRAY 1. , .

+1

All Articles