Skip to content

Commit 7d7ffc9

Browse files
author
mikeblome
committed
updates per STL review
1 parent 8f8ffde commit 7d7ffc9

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

docs/cpp-conformance-improvements-2017.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ For the complete list of conformance improvements up through Visual Studio 2015,
7070

7171
**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).
7272

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).
7474

7575
**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).
7676

@@ -765,7 +765,7 @@ int main()
765765
766766
767767
### 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.
769769
770770
```cpp
771771
int main()
@@ -786,15 +786,7 @@ warning C4843: 'void (__cdecl &)(void)': An exception handler of reference to ar
786786
The following code avoids the error:
787787

788788
```cpp
789-
int main()
790-
{
791-
try {
792-
throw "";
793-
}
794-
catch (int (*)[1]) {}
795-
catch (void (*)()) {}
796-
catch (const char*) {}
797-
}
789+
catch (int (*)[1]) {}
798790
```
799791

800792
### <a name="tr1"></a>std::tr1 namespace is deprecated
@@ -893,12 +885,12 @@ warning C4189: 's': local variable is initialized but not referenced
893885
The fix the error, remove the unused variable.
894886

895887
### 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.
897889

898890
```cpp
899891
/* C only */
900-
#pragma warning(disable:C4001) //C4619
901-
#pragma warning(disable:C4179)
892+
#pragma warning(disable:4001) //C4619
893+
#pragma warning(disable:4179)
902894
// single line comment
903895
//* single line comment */
904896
```
@@ -912,9 +904,9 @@ If the code does not need to be backwards compatible, you can avoid the warning
912904
```cpp
913905
/* C only */
914906

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)
918910

919911
// single line comment
920912
/* single line comment */
@@ -938,9 +930,15 @@ To fix the error, place the linkage specification before the __declspec attribut
938930
```cpp
939931
extern "C" __declspec(noinline) HRESULT __stdcall
940932
```
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:
942934
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:
936+
```cpp
937+
#pragma warning(disable:4768)
938+
#pragma warning (push)
939+
#include <shlobj.h>
940+
#pragma warning (pop)
941+
```
944942

945943
### <a name="extern_linkage"></a>Extern constexpr linkage
946944

@@ -966,7 +964,7 @@ In earlier versions of Visual Studio, the compiler incorrectly allowed the follo
966964
```cpp
967965
#include <typeinfo>
968966
969-
struct S {};
967+
struct S;
970968
971969
void f() { typeid(S); } //C2027 in 15.5
972970
```

docs/error-messages/compiler-warnings/compiler-warning-level-4-c4001.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ manager: "ghogen"
1818
---
1919
# Compiler Warning (level 4) C4001
2020
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.
2124
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).
2327

2428
## Example
2529
To disable warning, uncomment [#pragma warning(disable:4001)](../../preprocessor/warning.md).

0 commit comments

Comments
 (0)