This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Possible bug in gcc (Please Help)...
- From: John Love-Jensen <eljay at adobe dot com>
- To: Thomas J Amato <Thomas_J_Amato at raytheon dot com>, <gcc at gcc dot gnu dot org>, <gcc-help at gcc dot gnu dot org>
- Date: Wed, 15 May 2002 13:04:22 -0500
- Subject: Re: Possible bug in gcc (Please Help)...
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