Possible bug in gcc (Please Help)...
John Love-Jensen
eljay@adobe.com
Wed May 15 11:05:00 GMT 2002
Hi Tom,
You cannot forward declare an enum in C++.
The compiler can use a {signed|unsigned|nonsigned} char, short or int for
it. But the compiler doesn't know what it is using until it sees the enum's
definition. If it presumed that an enum was 1 byte, 2 byte, 4 byte,
whatever, you may end up with an unfortunate scenario.
My SAS/C++ compiler allows...
signed short enum Foo { kOne = 1, kTwo, kThree };
(Or was it "enum signed short Foo { ..."?)
...but that's a SAS/C++ idiosyncratic extension to C++. In that situation,
you could have forward declaration of the enum.
--Eljay
More information about the Gcc-help
mailing list