#define acos(X) _Generic((X), \
longdoublecomplex: cacosl, \
doublecomplex: cacos, \
floatcomplex: cacosf, \
longdouble: acosl, \
float: acosf, \
default:acos\
)(X)
Also, need to remember that character constants are ints, and not char.
Also, __auto_type is pretty cool:
#define max(a,b) \
({ __auto_type _a = (a); \
__auto_type _b = (b); \
_a > _b ? _a : _b; })
Keine Kommentare:
Kommentar veröffentlichen