This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C constant expressions proposals
On Tue, 17 Aug 2004, Richard Henderson wrote:
> Not possible. C++ needs to handle *all* expressions. If the
> assembler can't handle it, then the compiler needs to generate
> a constructor to do the job.
And C++ allowing all expressions in static initializers makes this a lot
simpler for C++ than for C, as whether something is an address constant
makes no difference to the acceptance of the program, only to the order of
initialization, and the get-out clause in [basic.start.init] paragraph 2
means that "what the compiler of the day can fold to a constant" is a
suitable definition of constants in initializers (as long as it can fold
everything the standard requires to be constant). Of course the C++
compiler is still restricted to outputting valid assembler, and therefore
to being conservative about what the assembler might accept.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)