This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
standards question relating to uninitialized variables
- To: egcs at egcs dot cygnus dot com
- Subject: standards question relating to uninitialized variables
- From: Zack Weinberg <zack at rabi dot columbia dot edu>
- Date: Sun, 14 Mar 1999 17:10:34 -0500
Given this code:
extern void use(int);
enum foo
{
a = 0, b, c, d
};
void
func(enum foo bar)
{
int x;
if(bar == a)
x = 0;
else if(bar == b)
x = 4;
else if(bar == c)
x = 9;
else if(bar == d)
x = 16;
use(x);
}
Is GCC allowed to assume that `bar' has one of the defined enumeration
values when compiling C? What about C++?
zw