Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Essential type of enumerated constants
#1
What is the essential type of an enumerated constant? I believe it should be integer constant, and rule 10.3 seems to agree since it says this expression is compliant:

s8a = K1; /* constant value fits */

However, my static analyzer insists that this is a violation:

Code:
enum list {
ONE,
TWO,
THREE,
}

int c;
for( c = 0; c < THREE; c++ )  /* THREE is an integer constant so comparing it with c, an int, is not a violation */
....
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)