Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.12 KB

compiler-warning-level-4-c4001.md

File metadata and controls

32 lines (26 loc) · 1.12 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 4) C4001
Compiler Warning (level 4) C4001
11/04/2016
C4001
C4001
414a47fe-d597-425e-9374-6a569231dc0a

Compiler Warning (level 4) C4001

nonstandard extension 'single line comment' was used

Note

This warning is removed in Visual Studio 2017 version 15.5 because single-line comments are standard in C99.

Single-line comments are standard in C++ and standard in C starting with C99. 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).

Example

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
}