On Thu, 11 May 2017, Jonathan Wakely wrote:

> On 10 May 2017 at 23:14, Daniel Santos wrote:
> > Well my primary goal is programming with values that are constant in the
> > compiler.  There is no language in any C specification (that I'm aware of)
> > for a "compile-time constant", but the concept is very important.  So just
> > because some expression is a compile-time constant doesn't mean we morph
> > into a "constant expression" (as per the spec), even with
> > __attribute__((const)).
> 
> The C standard says "An implementation may accept other forms of
> constant expressions." That means rather than inventing some
> "constprop" you could just extend GCC to treat more expressions
> involving constants as constant-expressions.

Note that while "other forms" might be accepted in initializers, they 
would still not be integer constant expressions (see DR#312).

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to