[Cfp-interest] tgmath and macro suppression

Jim Thomas jaswthomas at sbcglobal.net
Thu Mar 22 20:39:34 PDT 2012


On Mar 22, 2012, at 5:09 PM, Joel C. Salomon wrote:

> Jim Thomas <jaswthomas at sbcglobal.net> wrote:
>> C11 doesn’t say what effect macro suppression has on the non-double
>> functions invoked by tgmath. I think macro suppression should happen if and
>> only if the program suppresses macro replacement for the function.
> 
> If that were the case, this would be cause for a rather severe defect
> report, given that <tgmath.h> is supposed to be implementable by mans
> of the _Generic keyword.
> 
> E.g., ignoring long doubles, within <tgmath.h> exp() will be defined
> something like this:
>    #define exp(x) _Generic((x), float:expf, default:exp)(x)

What if, instead, it were

   #define exp(x) _Generic((x), float:expf(x), default:exp(x))

(I realize this isn't what C11 suggests.)

-Jim

> —which definitely suppresses macro expansion of expf().
> 
> —Joel




More information about the Cfp-interest mailing list