This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questions about a constant array reference in the C++ frontend
- From: Paul Schlie <schlie at comcast dot net>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Kazu Hirata <kazu at cs dot umass dot edu>,<gcc at gcc dot gnu dot org>,<nathan at codesourcery dot com>
- Date: Mon, 09 May 2005 20:57:51 -0400
- Subject: Re: Questions about a constant array reference in the C++ frontend
> From: Mark Mitchell <mark@codesourcery.com>
>> Paul Schlie wrote:
>> - ??? no such thing, you can't "dynamically" initialize a "static const",
>> as then it's not a "static const", but rather simply a global "const"
>>
>> (as a "static const" object is logically equivalent to a named/addressable
>> literal, yes?)
>
> No, it's not.
>
> static const int i = f();
Admittedly didn't think that was legal, as I though all "static const"
initializer values needed to be resolvable at compile time, directly or
indirectly from literal values by the front-end, or otherwise invalid.