Thomas Richter <[EMAIL PROTECTED]> writes: > g++-3.3 should warn about an object declared as a class that is later > on used as a "struct". This would simplify the generation of portable > code as at least one other popular compiler will generate warnings for > this case that could be easily avoided by this additional g++ > warning. Besides, implementation seems to be simple for me.
I strongly disagree. gcc should *not* warn about such things. This is like asking for a warning in the code printf("%s\n", "Hello"); Warning: the return value of the function is ignored *Of course* it is ignored, this is the clear and direct intention of this code, no need to warn. Likewise, *of course* you still refer to the same thing whether you call it class or struct. There is absolutely nothing wrong with doing so, and the compiler should not warn about it. A compiler that does warn about mixing class and struct keywords is plain broken, and users of that compiler need to accept that they have to work around this brokenness (e.g. by upgrading to a later version of that compiler). They may also chose to put a #pragma warn in their code to suppress that warning. Regards, Martin