On Wed, 15 Nov 2017, Richard Biener wrote: > Thanks - I suppose we can't avoid the repeated expansion by sth like > > #define exp(Val) ({ __typeof__ Val tem = Val; __TGMATH_UNARY_REAL_IMAG > (tem, exp, cexp); })
Well, that still expands its argument twice. You'd need to use __auto_type to avoid the double expansion. And then you'd still have extremely complicated expansions (that are correspondingly unfriendly if a user makes a mistake with a call, e.g. an argument of unsupported type), and complications around getting the right semantics when decimal floating point is involved. And use of ({ }) doesn't work in sizeof outside functions. And that wouldn't help with cases such as __STDC_TGMATH_OPERATOR_EVALUATION__, whereas it would actually be easy to add __builtin_tgmath_operator that's handled the same as __builtin_tgmath but ends up calling a function based on evaluation formats and producing an EXCESS_PRECISION_EXPR. (Clang overloadable functions in C don't avoid the multiple expansion either, or at least Clang's tgmath.h doesn't.) -- Joseph S. Myers jos...@codesourcery.com