__noop

Microsoft 特定的 __noop 內建函式會指定應該忽略函式。 會剖析引數清單,但不會為引數產生任何程式碼。 編譯器會針對編譯器警告 C4100 和類似的分析,將引數視為參考。 內部 __noop 函數適用于採用可變引數數目的全域偵錯函式。

編譯器會在編譯時期將 __noop 內建函式轉換成 0。

範例

下列程式碼示範如何使用 __noop

// compiler_intrinsics__noop.cpp
// compile using: cl /EHsc /W4 compiler_intrinsics__noop.cpp
// compile with or without /DDEBUG
#include <stdio.h>

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

#define IGNORE(x) { __noop(x); }

int main(int argv, char ** argc)
{
   IGNORE(argv);
   IGNORE(argc);
   PRINT("\nDEBUG is defined\n");
}

另請參閱

編譯器內建函式
關鍵字