小编Luc*_*ndi的帖子

#define X Defined(Y) 是有效的 C/C++ 宏定义吗?

我在某处读到

#define X defined(Y)
Run Code Online (Sandbox Code Playgroud)

无效,但似乎有效。

这是一个例子:

#define WIN_PLAT defined(_WIN32)

#if WIN_PLAT
#    undef  WIN_PLAT
#    define WIN_PLAT 1
#else
#    undef  WIN_PLAT
#    define WIN_PLAT 0
#endif
Run Code Online (Sandbox Code Playgroud)

c c++ macros c-preprocessor

4
推荐指数
1
解决办法
214
查看次数

标签 统计

c ×1

c++ ×1

c-preprocessor ×1

macros ×1