Why and when to use __noop?

后端 未结 3 1784
再見小時候
再見小時候 2021-02-18 17:06

I was reading about __noop and the MSDN example is

#if DEBUG
   #define PRINT   printf_s
#else
   #define PRINT   __noop
#endif

int main() {
   PRINT(\"\\nhello         


        
3条回答
  •  心在旅途
    2021-02-18 17:36

    How about:

    if (condition)
      PRINT("hello\n");
    next_statetment;
    

    I think, that without __noop, in Release mode 'next_statetment' will be executed only when 'condition' is true, and this a bug, which is very difficult to find.

提交回复
热议问题