Topic: enumerations
Author: wreggit@edfub1.ctis.af.mil (David Wreggit)
Date: 15 Nov 1993 21:10:23 GMT Raw View
I seem to have run into some inconsistencies with regard to how the
compilers I have are handling enumerators.
Given the following code fragment:
{
enum { APPLE, ORANGE, PEAR} fruit;
enum { RED=100, BLUE, YELLOW} color;
color = PEAR;
}
One of the compilers I have compiles this without any warning.
The other compiler gives me the following error:
W, test.cc(7,10) enum assigned to enum of different type
v
7 color = PEAR;
_________________________________________________
The question I have is, are enumerators supposed to do type checking?
I tend to think that the compiler should issue an error and am
wondering if the warning is generated to allow older code to compile.
Please e-mail directly to me. Thanks.
--
wreggit@ctis.af.mil