On Fri, 2 Sep 2011, Vincent Torri wrote:

>
>
> On Fri, 2 Sep 2011, cnook wrote:
>
>
> using typedef enum _foo
> { *** } foo;
>
> would be cleaner. I'm wondering if the c++ standard forbid such construction

for records:

after some googling, forward declarations of enum are forbidden. Section 
7.2.5 of the ISO C++ Standard:

     The underlying type of an enumeration is an integral type that can 
represent all the enumerator values defined in the enumeration. It is 
implementation-defined which integral type is used as the underlying type 
for an enumeration except that the underlying type shall not be larger 
than int unless the value of an enumerator cannot fit in an int or 
unsigned int. If the enumerator-list is empty, the underlying type is as 
if the enumeration had a single enumerator with value 0. The value of 
sizeof() applied to an enumeration type, an object of enumeration type, or 
an enumerator, is the value of sizeof() applied to the underlying type.

As the size must be defined to set up the call stack, the number of 
enumerations in the enum must be known when doing the forward declaration.

I've read that c++11 now allows forward declaration of enum types.

Vincent

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to