[RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

Marek Polacek polacek@redhat.com
Thu May 11 10:44:00 GMT 2017


On Thu, May 11, 2017 at 11:12:24AM +0100, 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.
> 
> There are enhancement requests for this in Bugzilla, because some
> compilers are already more catholic in what they accept in constant
> expressions (notably, Clang).

Right, at least:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69960
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66618

	Marek



More information about the Gcc mailing list