[C/C++] enable/disable function/macro with define switch.

Language/C&C++ 2011.11.23 15:22

There are two simple examples for this.

#ifdef A
#define xxx(...) BBBB(__VA_ARGS__)
#else
#define xxx(...)
#endif

vs.

#ifdef A
#define xxx(...) BBBB(__VA_ARGS__)
#else
static inline void xxx(){}
#endif

I preferred the second one because at the first case, sometimes unexpected problems are issued. (Just personal opinion/preference...)
신고
Trackback 0 : Comment 0

티스토리 툴바