[cfe-dev] Premature macro expansion in preprocessor?

Chandler Carruth chandlerc at google.com
Fri Nov 9 15:39:09 PST 2012

On Fri, Nov 9, 2012 at 3:06 PM, Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:
> On Friday, November 09, 2012 11:48 PM, Chandler Carruth wrote:
>> Personally, I also find it distasteful that the feature tests are
>> treated as normal function-style-macros, as I don't think it is
>> reasonable to use your LP and RP macros above ...
> Yes, its only use, I think, is in some obfuscated coding contest!
>> I wonder if it would make more sense to define the feature tests
>> as special tokens in the preprocessor much like defined().
> Actually, I differ in opinion here.  I think it is useful that they
> are implemented as function-style-macros because this means they
> can be used in contexts outside of #if directives.  defined() is
> limited in its usefulness by this.

I wasn't suggesting we have to give them exactly the same constraints,
more meaning that there is plenty of precedent for representing these
as something more constrained than function style macros.

More information about the cfe-dev mailing list