[Cfp-interest] tgmath and macro suppression

Jim Thomas jaswthomas at sbcglobal.net
Thu Mar 22 16:15:51 PDT 2012


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. 

Thus, assuming the implementation does macro replacement for expf, say

// math.h

float expf(float);
#define expf(x) __expf(x) 

then 

#include <tgmath.h>

float a(float f) { return exp(f); }


should invoke __expf

and

#include <tgmath.h>

#undef expf

float b(float f) { return exp(f); }



should invoke expo.

Would people please check this behavior on their implementations? (If expf isn't macro-replaced in math.h, pick a non-double function that is.)

-Jim


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120322/4426c49c/attachment.html 


More information about the Cfp-interest mailing list