Macro to turn off printf statements

后端 未结 10 1618
粉色の甜心
粉色の甜心 2020-12-14 08:42

What MACRO can be used to switch off printf statements, rather than removing them all for deployment builds, I just want to switch them off, skip them, ignore them.

10条回答
  •  佛祖请我去吃肉
    2020-12-14 08:55

    Another possibility would be something like freopen("/dev/null", "w", stdout);

    This doesn't exactly disable printf though -- it's roughly equivalent to running your program with stdout redirected to /dev/null, like: ./myprog > /dev/null at the shell prompt.

提交回复
热议问题