小编Ben*_* B.的帖子

你可以在C中定义评论吗?

我正在尝试做一个调试系统,但它似乎不起作用.

我想要完成的是这样的事情:

#ifndef DEBUG
    #define printd //
#else
    #define printd printf
#endif
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?我有很多调试消息,我不想这样做:

if (DEBUG)
    printf(...)

code

if (DEBUG)
    printf(...)

...
Run Code Online (Sandbox Code Playgroud)

c debugging c-preprocessor

28
推荐指数
5
解决办法
2万
查看次数

标签 统计

c ×1

c-preprocessor ×1

debugging ×1