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++ front end
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Paul Schlie <schlie at comcast dot net>
- Cc: Mark Mitchell <mark at codesourcery dot com>, 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 19:35:05 -0700
- Subject: Re: Questions about a constant array reference in the C++ front end
- References: <BEA57F4F.A19A%schlie@comcast.net>
Paul Schlie <schlie@comcast.net> writes:
>> From: Mark Mitchell <mark@codesourcery.com>
>> 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.
In C what you say is true; in C++ initializers may execute arbitrary
code.
zw