Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22448

Is there a warning for assigning an enum variable with a value out of the range of the enum?

$
0
0

I have a C function which uses an enum as parameter, like the example bellow:

typedef enum
{
  AB, 
  CD
} A;

void f(A input)
{
  // do something
}

int main(void)
{
   // do something
   f(-10);
   // do something
}

Is there a warning that I can enable for assigning an enum variable with a value out of the range of the enum?


Viewing all articles
Browse latest Browse all 22448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>