You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cpp-conformance-improvements-2017.md
+18-20Lines changed: 18 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ For the complete list of conformance improvements up through Visual Studio 2015,
70
70
71
71
**std::tr1 deprecated** The non-standard std::tr1 namespace is now marked as deprecated (in both C++14 and C++17 modes). For more information, see [std::tr1 namespace is deprecated](#tr1).
72
72
73
-
**Annex D features deprecated** When the /std:c++17 mode compiler switch is set, almost all Standard Library features in Annex D are marked as deprecated. For more information, see [Standard Library features in Annex D are marked as deprecated](#annex_d).
73
+
**Annex D features deprecated**Annex D of the C++ standard contains all the features that have been deprecated. When the /std:c++17 compiler switch is set, almost all the Standard Library features in Annex D are marked as deprecated. For more information, see [Standard Library features in Annex D are marked as deprecated](#annex_d).
74
74
75
75
**New compiler switch for extern constexpr** In earlier versions of Visual Studio, the compiler always gave a `constexpr` variable internal linkage even when the variable was marked `extern`. In Visual Studio version 15.5, a new compiler switch, [/Zc:externConstexpr](build/reference/zc-externconstexpr.md), enables correct standards-conforming behavior. For more information, see [extern constexpr linkage](#extern_linkage).
76
76
@@ -765,7 +765,7 @@ int main()
765
765
766
766
767
767
### Exception handlers
768
-
Handlers of reference to array or function type are never a match for any exception object. The compiler now correctly honors this rule. It also no longer matches a handler of 'char*' or 'wchar_t*' to a string literal when **/Zc:strictStrings** is used.
768
+
Handlers of reference to array or function type are never a match for any exception object. The compiler now correctly honors this rule and raises a level 4 warning. It also no longer matches a handler of `char*` or `wchar_t*` to a string literal when **/Zc:strictStrings** is used.
769
769
770
770
```cpp
771
771
int main()
@@ -786,15 +786,7 @@ warning C4843: 'void (__cdecl &)(void)': An exception handler of reference to ar
786
786
The following code avoids the error:
787
787
788
788
```cpp
789
-
intmain()
790
-
{
791
-
try {
792
-
throw "";
793
-
}
794
-
catch (int (*)[1]) {}
795
-
catch (void (*)()) {}
796
-
catch (const char*) {}
797
-
}
789
+
catch (int (*)[1]) {}
798
790
```
799
791
800
792
### <aname="tr1"></a>std::tr1 namespace is deprecated
@@ -893,12 +885,12 @@ warning C4189: 's': local variable is initialized but not referenced
893
885
The fix the error, remove the unused variable.
894
886
895
887
### Single line comments
896
-
In Visual Studio version 15.5, warnings C4001 and C4179 are no longer emitted by the C compiler. Previously, they were only emitted under the **/Za** compiler switch. The warnings are no longer needed because single line comments have been part of the C standard for several years.
888
+
In Visual Studio version 15.5, warnings C4001 and C4179 are no longer emitted by the C compiler. Previously, they were only emitted under the **/Za** compiler switch. The warnings are no longer needed because single line comments have been part of the C standard since C99.
897
889
898
890
```cpp
899
891
/* C only */
900
-
#pragma warning(disable:C4001) //C4619
901
-
#pragma warning(disable:C4179)
892
+
#pragma warning(disable:4001) //C4619
893
+
#pragma warning(disable:4179)
902
894
// single line comment
903
895
//* single line comment */
904
896
```
@@ -912,9 +904,9 @@ If the code does not need to be backwards compatible, you can avoid the warning
912
904
```cpp
913
905
/* C only */
914
906
915
-
#pragma warning(disable:C4619)
916
-
#pragma warning(disable:C4001)
917
-
#pragma warning(disable:C4179)
907
+
#pragma warning(disable:4619)
908
+
#pragma warning(disable:4001)
909
+
#pragma warning(disable:4179)
918
910
919
911
// single line comment
920
912
/* single line comment */
@@ -938,9 +930,15 @@ To fix the error, place the linkage specification before the __declspec attribut
938
930
```cpp
939
931
extern "C" __declspec(noinline) HRESULT __stdcall
940
932
```
941
-
This new warning C4768 will be given on some Windows SDK headers that were shipped with Visual Studio 2017 15.3 or older (for example: version1 0.0.15063.0, also known as RS2 SDK). However, later versions of Windows SDK headers have been fixed for this warning. Specifically, the headers that would have this warning are ShlObj.h and ShlObj_core.h. When you see this warning coming from Windows SDK headers, you can take these actions:
933
+
This new warning C4768 will be given on some Windows SDK headers that were shipped with Visual Studio 2017 15.3 or older (for example: version 10.0.15063.0, also known as RS2 SDK). However, later versions of Windows SDK headers (specifically, ShlObj.h and ShlObj_core.h) have been fixed so that they do not produce this warning. When you see this warning coming from Windows SDK headers, you can take these actions:
942
934
1) Switch to the latest Windows SDK that came with Visual Studio 2017 15.5 release.
943
-
2) Turn off the warning with #pragma warning(disable:4768, push) and pop around the #include of the Windows SDK header statement.
935
+
2) Turn off the warning around the #include of the Windows SDK header statement:
Copy file name to clipboardExpand all lines: docs/error-messages/compiler-warnings/compiler-warning-level-4-c4001.md
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,12 @@ manager: "ghogen"
18
18
---
19
19
# Compiler Warning (level 4) C4001
20
20
nonstandard extension 'single line comment' was used
21
+
22
+
> [!NOTE]
23
+
> This warning is removed in Visual Studio 2017 version 15.5 because single-line comments are standard in C99.
21
24
22
-
Single-line comments are standard in C++ and nonstandard in C. Under strict ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), 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).
25
+
Single-line comments are standard in C++ and standard in C starting with C99.
26
+
Under strict ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), 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).
23
27
24
28
## Example
25
29
To disable warning, uncomment [#pragma warning(disable:4001)](../../preprocessor/warning.md).
0 commit comments