I've been trying to use this declaration but whether on Visual Studio 2012 or CodeBlocks (with GCC) it never builds.
(from http://netghost.narod.ru/gff2/graphics/summary/fli.htm)
typedef struct _ColormapChunk
{
CHUNKHEADER Header; /* Header for this chunk */
WORD NumberOfElements; /* Number of color elements in map */
struct _ColorElement /* Color element (one per NumberOfElements) */
{
BYTE SkipCount; /* Color index skip count */
BYTE ColorCount; /* Number of colors in this element */
struct _ColorComponent /* Color component (one /'ColorCount') */
{
BYTE Red; /* Red component color */
BYTE Green; /* Green component color */
BYTE Blue; /* Blue component color */
} ColorComponents[ColorCount];
} ColorElements[NumberOfElements];
} COLORMAPCHUNK;
Visual Studio : error C2327: '_ColormapChunk::_ColorElement::ColorCount' : is not a type name, static, or enumerator
CodeBlocks : error: invalid use of non-static data member '_ColormapChunk::_ColorElement::ColorCount'
On these questions it is explained that is possible under C++ 11 :
Why can't I initialize non-const static member or static array in class?
Can you use the sizeof one member when declaring another member?
So on CodeBlocks I've ticked the option :
Have g++ follow the C++11 ISO language standard [-std=c++11]
On VS I couldn't find such option, on CodeBlocks it's still not compiling.
Is this declaration usable as such or does it need some changes ? If so, which ones ?