On Friday 02 September 2011 09:12:07 Vincent Torri wrote:
> using typedef enum _foo
> { *** } foo;
>
> would be cleaner. I'm wondering if the c++ standard forbid such
> construction
Yes, but only because it uses a name with a leading underscore, which is
reserved in the global namespace. That said, the e-typic _Foo, i.e. leading
underscore followed by an uppercase letter is reserved anywhere. Actually, I
believe this is even a reserved identifier in C, not just C++.
Working alternatives:
// 1. tagname = typedef name:
typedef enum Foo { *** } Foo;
// 2. anonymous with a typedef name
typedef enum { *** } Foo;
// 3. typedef only for C, C++ doesn't need it anyway
enum Foo { *** };
#ifndef __cplusplus
typedef enum Foo Foo;
#endif
All are legal C and legal C++, to the best of my knowledge.
Uli
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel