Undefine a function-like macro in C?

时光怂恿深爱的人放手 提交于 2019-12-25 02:50:14

问题


I am trying to do some hacks over the glibc, and I wanted to know whether it's possible to redefine function-like macros ?

For example, <tgmath.h> has the following macro:

#define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)

How to redefine expm1 as :

#define expm1(Val) __TGMATH_UNARY_REAL_IMAG (Val, expm1, cexpm1)

I suppose that I have to cancel the previous definition but I do not know exactly how to do that.


回答1:


Exactly. Just undefine it first.

#ifdef expm1
#undef expm1
#endif

#define expm1(Val) __TGMATH_UNARY_REAL_IMAG (Val, expm1, cexpm1)


来源:https://stackoverflow.com/questions/15958638/undefine-a-function-like-macro-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!