Skip to content

Commit ad05f03

Browse files
TylerMSFTTylerMSFT
authored andcommitted
more tuning
1 parent 913e316 commit ad05f03

2 files changed

Lines changed: 14 additions & 18 deletions

File tree

docs/overview/compiler-versions.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ For example, the compiler version for Visual Studio 2022 version 17.9.0 is 19.39
2727
- The build version is 33519
2828
- The revision version is 0
2929

30-
The macros reflect these values like so:
30+
The macros reflect these values like this:
3131
- `_MSC_VER = 1939`
3232
- `_MSC_FULL_VER = 193933519`
3333
- `_MSC_BUILD` (the revision) is 0.
3434

35-
Note: Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and consequently have the same value for `_MSC_VER`), as do Visual Studio 2019 16.10 and 16.11. To distinguish them, use `_MSC_FULL_VER` as described in [Service releases starting with Visual Studio 2017](#service-releases-starting-with-visual-studio-2017).
35+
Note: Visual Studio 2019 16.8 and 16.9 share the same major and minor versions, and consequently have the same value for `_MSC_VER`. As do Visual Studio 2019 16.10 and 16.11. To distinguish them, use `_MSC_FULL_VER` as described in [Service releases starting with Visual Studio 2017](#service-releases-starting-with-visual-studio-2017).
3636

3737
How these fields change to distinguish between different versions of the compiler varies, as described in the following sections.
3838

@@ -54,9 +54,11 @@ How these fields change to distinguish between different versions of the compile
5454

5555
- Servicing releases can be distinguished by `_MSC_FULL_VER`. The build field (the BBBBB in the MMNNBBBBB version number) typically increases by 1.
5656

57-
For example, two cases where `_MSC_FULL_VER` is useful is to distinguish between Visual Studio 2019 16.8 from 16.9, and Visual Studio 2019 16.10 from 16.11. That's because those versions share the same major and minor versions (and consequently have the same value for `_MSC_VER`).
57+
For example, two cases where `_MSC_FULL_VER` is useful is to distinguish Visual Studio 2019 16.8 from 16.9, and Visual Studio 2019 16.10 from 16.11. That's because those versions share the same major and minor versions, and consequently have the same value for `_MSC_VER`.
5858

59-
To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
59+
To distinguish these versions, use `_MSC_FULL_VER`.\
60+
The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.8 is 192829333.\
61+
The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
6062

6163
## Version macros
6264

@@ -67,11 +69,11 @@ N - minor version (two digits)\
6769
B - build version (five digits)\
6870
R - revision version
6971

70-
**[`_MSC_VER`](../preprocessor/predefined-macros.md)** distinguishes between different versions of the compiler at a high level. It has the form `_MSC_VER` = MMNN. Use it to distinguish between major and minor releases.
72+
**[`_MSC_VER`](../preprocessor/predefined-macros.md)** distinguishes between major and minor releases. It has the form: MMNN.
7173

72-
**[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md)** represents the major, minor, and build version of the compiler. It has the form `_MSC_FULL_VER` = MMNNBBBBB. Use it to distinguish between different versions of the compiler, including servicing releases. Because Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and consequently have the same value for `_MSC_VER`), distinguish them using `_MSC_FULL_VER`. The same is true for Visual Studio 2019 16.10 and 16.11.
74+
**[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md)** represents the major, minor, and build version of the compiler. It has the form: MMNNBBBBB. Use it to distinguish between different versions of the compiler, including servicing releases. See [Service releases starting with Visual Studio 2017](#service-releases-starting-with-visual-studio-2017) for more information about Visual Studio 2019 16.8, 16.9, 16.10 and 16.11.
7375

74-
**[`_MSC_BUILD`](../preprocessor/predefined-macros.md)** represents the build version of the compiler. It has the form `_MSC_BUILD` = R. Use it to distinguish between servicing releases.
76+
**[`_MSC_BUILD`](../preprocessor/predefined-macros.md)** represents the build version of the compiler. It has the form: R. Use it to distinguish between servicing releases.
7577

7678
When the major version changed between Visual Studio 2013 and Visual Studio 2015, `_MSC_VER` reflected the change by going from 1800 to 1900.
7779

docs/preprocessor/predefined-macros.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ no-loc: [_ATL_VER, __ATOM__, __AVX__, __AVX2__, __AVX512BW__, __AVX512CD__, __AV
1010
---
1111
# Predefined macros
1212

13-
The Microsoft C/C++ compiler (MSVC) predefines certain preprocessor macros, depending on the language (C or C++), the compilation target, and the chosen compiler options.
13+
The Microsoft C/C++ compiler (MSVC) predefines certain preprocessor macros depending on the language (C or C++), the compilation target, and the chosen compiler options.
1414

1515
MSVC supports the predefined preprocessor macros required by the ANSI/ISO C99, C11, and C17 standards, and the ISO C++14, C++17, and C++20 standards. The implementation also supports several more Microsoft-specific preprocessor macros.
1616

@@ -244,16 +244,12 @@ MSVC supports other predefined macros:
244244
245245
- `_MSC_EXTENSIONS` Defined as 1 if the on-by-default [**`/Ze`** (Enable Language Extensions)](../build/reference/za-ze-disable-language-extensions.md) compiler option is set. Otherwise, undefined.
246246
247-
- `_MSC_FULL_VER` Defined as an integer literal that encodes the major, minor, and build number elements of the compiler's version number. The major number is the first element of the period-delimited version number, the minor number is the second element, and the build number is the third element. For example, if the Microsoft C/C++ compiler version is 19.39.33519, `_MSC_FULL_VER` evaluates to 193933519. Enter `cl /?` at the command line to view the compiler's version number. This macro is always defined.
247+
- `_MSC_FULL_VER` Defined as an integer literal that encodes the major, minor, and build number elements of the compiler's version number. The major number is the first element of the period-delimited version number, the minor number is the second element, and the build number is the third element.
248248
249-
Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for 16.9 is 192829910.
250-
251-
Visual Studio 2019 16.10 and 16.11 also share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for 16.11 is 192930129.
249+
For example, if the Microsoft C/C++ compiler version is 19.39.33519, `_MSC_FULL_VER` evaluates to 193933519. Enter `cl /?` at the command line to view the compiler's version number. This macro is always defined. See [C++ compiler versioning](../overview/compiler-versions.md) for more information about compiler versioning, and specifically [Service releases starting with Visual Studio 2017](../overview/compiler-versions.md#service-releases-starting-with-visual-studio-2017) for more information about Visual Studio 2019 16.8, 16.9, 16.10 and 16.11 which require `_MSC_FULL_VER` to tell them apart.
252250
253251
- `_MSC_VER` Defined as an integer literal that encodes the major and minor number elements of the compiler's version number. The major number is the first element of the period-delimited version number and the minor number is the second element. For example, if the version number of the Microsoft C/C++ compiler is 17.00.51106.1, the `_MSC_VER` macro evaluates to 1700. Enter `cl /?` at the command line to view the compiler's version number. This macro is always defined.
254252
255-
See [C++ compiler versioning](../overview/compiler-versions.md) for more information about the history of compiler versioning, and compiler version numbers and the Visual Studio versions they correspond to.
256-
257253
To test for compiler releases or updates in a given version of Visual Studio or after, use the `>=` operator. You can use it in a conditional directive to compare `_MSC_VER` against that known version. If you have several mutually exclusive versions to compare, order your comparisons in descending order of version number. For example, this code checks for compilers released in Visual Studio 2017 and later. Next, it checks for compilers released in or after Visual Studio 2015. Then it checks for all compilers released before Visual Studio 2015:
258254
259255
```cpp
@@ -266,11 +262,9 @@ MSVC supports other predefined macros:
266262
#endif
267263
```
268264

269-
Visual Studio 2019 16.8 and 16.9 share the same major and minor versions (and consequently have the same value for `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
270-
271-
Visual Studio 2019 16.10 and 16.11 share the same major and minor versions (and consequently have the same value for `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.11 is 192930129.
265+
For more information about Visual Studio 2019 16.8 and 16.9, and 16.10 and 16.11, which share the same major and minor versions (and consequently have the same value for `_MSC_VER`), see [Service releases starting with Visual Studio 2017](../overview/compiler-versions.md#service-releases-starting-with-visual-studio-2017) for more information.
272266

273-
For more information about compiler versioning, see [Visual C++ Compiler Version](https://devblogs.microsoft.com/cppblog/visual-c-compiler-version/) in the Microsoft C++ Team Blog.
267+
For more information about the history of compiler versioning, and compiler version numbers and the Visual Studio versions they correspond to, see [C++ compiler versioning](../overview/compiler-versions.md). Also, [Visual C++ Compiler Version](https://devblogs.microsoft.com/cppblog/visual-c-compiler-version/) on the Microsoft C++ team blog.
274268

275269
- `_MSVC_LANG` Defined as an integer literal that specifies the C++ language standard targeted by the compiler. It's set only in code compiled as C++. The macro is the integer literal value `201402L` by default, or when the [`/std:c++14`](../build/reference/std-specify-language-standard-version.md) compiler option is specified. The macro is set to `201703L` if the [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) compiler option is specified. The macro is set to `202002L` if the [`/std:c++20`](../build/reference/std-specify-language-standard-version.md) compiler option is specified. It's set to a higher, unspecified value when the [`/std:c++latest`](../build/reference/std-specify-language-standard-version.md) option is specified. Otherwise, the macro is undefined. The `_MSVC_LANG` macro and [`/std` (Specify language standard version)](../build/reference/std-specify-language-standard-version.md) compiler options are available beginning in Visual Studio 2015 Update 3.
276270

0 commit comments

Comments
 (0)