C typedef deficiency
portegys at ihuxv.UUCP
portegys at ihuxv.UUCP
Thu Jun 23 00:38:24 AEST 1983
I was suprised to find out recently that C does not allow
identical enumeration names within different data types. I
am working under UNIX 5.0 on a VAX 11/780. Here is an example
of what I mean:
----------------------------------------------
typedef enum {
GREEN,
RIPE,
ROTTEN
} APPLE;
typedef enum {
SOUR,
JUICY,
ROTTEN
} ORANGE;
main() {
ORANGE fruitx;
APPLE fruity;
fruitx = ROTTEN;
fruity = ROTTEN;
}
----------------------------------------------
This program will not compile, due to the redeclared symbol ROTTEN.
I think this is a deficiency of C, since the two values of ROTTEN
apply to different data types.
Tom Portegys, BTL IH, ihuxv!portegys
More information about the Comp.lang.c
mailing list