Compiler Warning (level 4) C4001

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Warning (level 4) C4001.

nonstandard extension 'single line comment' was used

Single-line comments are standard in C++ and nonstandard in C. Under strict ANSI compatibility (/Za), C files that contain single-line comments, generate C4001 due to the usage of a nonstandard extension. Since single-line comments are standard in C++, C files containing single-line comments do not produce C4001 when compiling with Microsoft extensions (/Ze).

To disable warning, uncomment #pragma warning(disable:4001).

// C4001.cpp  
// compile with: /W4 /Za /TC  
// #pragma warning(disable:4001)  
int main()  
{  
   // single-line comment in main  
   // C4001  
}  

Show: