AnsweredAssumed Answered

"Accidental" forward declaration of enum without compiler warning?

Question asked by Christoph Scholtes on Mar 19, 2008
Latest reply on Mar 19, 2008 by CompilerGuru
Hi,
 
I am running CodeWarrior IDE 5.7.0 Build 2211 with an S12XE processor.
 
Consider this code:
 
enum MyEnumDef { ALARM, SHUTDOWN };
 
struct MyStructDef {
  enum MyEnumDefS MyEnumDeclaration;
};
 
struct MyStructDef MyStructDeclaration;
 
and later in the code in a function:
 
MyStructDeclaration.MyEnumDeclaration = ALARM;
 
Please note the typo when declaring MyEnumDeclaration within the struct! The compiler eats this without any complaint. Why is that? It seems like it does not matter how I declare the enum within the struct. I can declare it as "yadiyadiblabla" and the compiler does not care. Same code in Code Composer produces a "Forward declaration of enum type is non-standard" warning. Is this expected behavior?
 
Thanks,
Chris

Outcomes