[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFC, problem with g++4

Florian Weimer <fw@deneb.enyo.de> writes:

> * Antti-Juhani Kaijanaho:
>> The anon enumeration trick has been an established C++ idom for years
>> (ISTR, but cannot check now, even Stroustrup himself advocating it).
> This was once desirable because you couldn't declare real constants in
> classes.  Today,
>   template <typename T>
>   struct Foo
>   {
>     static const unsigned N = T::N;
>     char bar[N];
>   };
> works and the enum trick lost its importance.

Doesn't that still make N a real variable in memory and does not get
optimized away like enums?


Reply to: