class rlCommand
{
public:
union
{
unsigned char rawData[256];
struct
{
unsigned char id[2];
unsigned char size;
unsigned char data[253];
};
};
rlCommand() {}
~rlCommand() {}
};
but g++ complains about it.
command.h:52: anonymous class type not used to declare any objects
The same thing compiles just fine under MSVC++ 6. Reading the C++ ANSI standard didn''t tell me much about this. Anybody knows if it''s a legal construct?
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
gcc problems (C++ theory)
I believe this is a valid C++ statement:
I tried your code on four different compilers, and only g++ warns about it. Even g++ believe this is a valid declaration, since it accepts the code (it''s a warning, not an error).
Looks like that message is a somewhat misdirected attempt to warn the programmer about any anonymous struct/class/union types for which no objects are declared. Ignore the warning.
Looks like that message is a somewhat misdirected attempt to warn the programmer about any anonymous struct/class/union types for which no objects are declared. Ignore the warning.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement