Skip to content

Commit 04be1fa

Browse files
TylerMSFTTylerMSFT
authored andcommitted
feedback
1 parent 90f7554 commit 04be1fa

2 files changed

Lines changed: 31 additions & 26 deletions

File tree

docs/overview/compiler-versions.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ helpviewer_keywords: ["Visual C++, platforms supported", "platforms [C++]"]
88
---
99
# Microsoft Visual C++ compiler versioning
1010

11-
The Microsoft Visual C++ compiler version consists of four fields. They are reflected in various Microsoft-specific compiler macros that can be used to distinguish which version of the compiler is compiling your code.
11+
The Microsoft Visual C++ compiler version consists of four fields. They're reflected in various Microsoft-specific compiler macros that can be used to distinguish which version of the compiler is compiling your code.
1212

1313
The version number consists of four fields:
1414

15-
M - major version (2 digits)\
16-
m - minor version (2 digits)\
17-
B - build version (5 digits)\
15+
M - major version (two digits)\
16+
N - minor version (two digits)\
17+
B - build version (five digits)\
1818
R - revision version
1919

2020
Microsoft-specific compiler macros encode these fields as follows:
2121

22-
`_MSC_VER` = MMmm
23-
`_MSC_FULL_VER` = MMmmBBBBB
24-
`_MSC_BUILD` = R
22+
`_MSC_VER = MMNN`
23+
`_MSC_FULL_VER = MMNNBBBBB`
24+
`_MSC_BUILD = R`
2525

2626
For example, for Visual Studio 2022 version 17.9.0, the compiler version is 19.39.33519. The major version is 19, the minor version is 39, the build version is 33519, and the revision version is 0. In other words, `_MSC_VER` is 1939, `_MSC_FULL_VER` is 193933519, and `_MSC_BUILD` (the revision) is 0.
2727

28-
Note: 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` instead as described in [Service releases starting with Visual Studio 2017](#service-releases-starting-with-visual-studio-2017). The same is true for distinguishing Visual Studio 2019 16.10 and 16.11.
28+
Note: 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` instead as described in [Service releases starting with Visual Studio 2017](#service-releases-starting-with-visual-studio-2017). The same is true for distinguishing Visual Studio 2019 16.10 from 16.11.
2929

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

@@ -45,24 +45,27 @@ Note: Visual Studio .NET 2003 was considered a minor release.
4545

4646
### Service releases starting with Visual Studio 2017
4747

48-
- Servicing releases can be distinguished using `_MSC_FULL_VER`. The build field (the BBBBB in the MMmmBBBBB version number) typically increases by 1.
48+
- Servicing releases can be distinguished using `_MSC_FULL_VER`. The build field (the BBBBB in the MMNNBBBBB version number) typically increases by 1.
4949

50-
For example, two cases where `_MSC_FULL_VER` is particularly useful is to distinguish between Visual Studio 2019 16.8 and 16.9, as well as Visual Studio 2019 16.10 and 16.11. The reason is that those versions share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`.
50+
For example, two cases where `_MSC_FULL_VER` is useful is to distinguish between Visual Studio 2019 16.8 and 16.9, as well as Visual Studio 2019 16.10 and 16.11. The reason is that those versions share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`.
5151

5252
## Version macros
5353

5454
Recall that the version number consists of four fields:
5555

56-
M - major version (2 digits)\
57-
m - minor version (2 digits)\
58-
B - build version (4 digits)\
56+
M - major version (two digits)\
57+
N - minor version (two digits)\
58+
B - build version (five digits)\
5959
R - revision version
6060

61-
- [`_MSC_VER`](../preprocessor/predefined-macros.md) distinguishes between different versions of the compiler at a high level. It's used to distinguish between major and minor releases. `_MSC_VER` = MMmm.
62-
- [`_MSC_FULL_VER`](../preprocessor/predefined-macros.md) represents the major, minor, and build version of the compiler. `_MSC_FULL_VER` = MMmmBBBBB. It's used to distinguish between different versions of the compiler, including servicing releases. 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 same is true for Visual Studio 2019 16.10 and 16.11.
63-
- [`_MSC_BUILD`](../preprocessor/predefined-macros.md) represents the build version of the compiler. `_MSC_BUILD` = R.Use it to distinguish between servicing releases.
61+
[`_MSC_VER`](../preprocessor/predefined-macros.md) distinguishes between different versions of the compiler at a high level. Use it to distinguish between major and minor releases. `_MSC_VER = MMNN`.
6462

65-
For example, the major version changed between Visual Studio 2013 and Visual Studio 2015, reflected by a change in `_MSC_VER` from 1800 to 1900. An example of a minor change is from Visual Studio 2022 17.1 to Visual Studio 2022 17.2, when `_MSC_VER` changed from 1931 to 1932.
63+
[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md) represents the major, minor, and build version of the compiler. `_MSC_FULL_VER = MMNNBBBBB`. Use it used to distinguish between different versions of the compiler, including servicing releases. 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 same is true for Visual Studio 2019 16.10 and 16.11.
64+
65+
[`_MSC_BUILD`](../preprocessor/predefined-macros.md) represents the build version of the compiler. `_MSC_BUILD` = R. Use it to distinguish between servicing releases.
66+
67+
For example, the major version changed between Visual Studio 2013 and Visual Studio 2015, reflected by a change in `_MSC_VER` from 1800 to 1900.\
68+
An example of a minor change is from Visual Studio 2022 17.1 to Visual Studio 2022 17.2, when `_MSC_VER` changed from 1931 to 1932.
6669

6770
The following table lists the Visual C++ compiler `_MSC_VER` for each Visual Studio release:
6871

@@ -106,11 +109,11 @@ The following table lists the Visual C++ compiler `_MSC_VER` for each Visual Stu
106109
| Visual Studio 2022 version 17.9 | 1939 |
107110
| Visual Studio 2022 version 17.10 | 1940 |
108111

109-
<sup>a</sup> 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`. `_MSC_FULL_VER` for 16.8 is 192829333. `_MSC_FULL_VER` for 16.9 is 192829910.
112+
<sup>a</sup> 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 Visual Studio 2019 16.8 is 192829333. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.9 is 192829910.
110113

111-
<sup>b</sup> Visual Studio 2019 16.10 and 16.11 share the same major and minor versions (and `_MSC_VER`). To distinguish them, use `_MSC_FULL_VER`. `_MSC_FULL_VER` for 16.10 is 192933037. `_MSC_FULL_VER` for 16.11 is 192930133.
114+
<sup>b</sup> Visual Studio 2019 16.10 and 16.11 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 Visual Studio 2019 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.11 is 192930129.
112115

113116
## See also
114117

115-
[`_MSCVER`](../preprocessor/predefined-macros.md)\
118+
[`_MSC_VER`](../preprocessor/predefined-macros.md)\
116119
[Visual C++ compiler version blog post](https://devblogs.microsoft.com/cppblog/visual-c-compiler-version/)

docs/preprocessor/predefined-macros.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The compiler supports these predefined macros specified by the ISO C99, C11, C17
3838

3939
- `__FILE__` The name of the current source file. `__FILE__` expands to a character string literal. To ensure that the full path to the file is displayed, use [**`/FC`** (Full Path of Source Code File in Diagnostics)](../build/reference/fc-full-path-of-source-code-file-in-diagnostics.md). This macro is always defined.
4040

41-
- `__LINE__` Defined as the integer line number in the current source file. The value of the `__LINE__` macro can be changed by using a `#line` directive. The integral type of the value of `__LINE__` can vary depending on context. This macro is always defined.
41+
- `__LINE__` Defined as the integer line number in the current source file. The value of this macro can be changed by using a `#line` directive. The integral type of the value of `__LINE__` can vary depending on context. This macro is always defined.
4242

4343
- `__STDC__` Defined as 1 when compiled as C and if the [`/Za`](../build/reference/za-ze-disable-language-extensions.md) compiler option is specified. Starting in Visual Studio 2022 version 17.2, it's defined as 1 when compiled as C and if the [`/std:c11`](../build/reference/std-specify-language-standard-version.md) or [`/std:c17`](../build/reference/std-specify-language-standard-version.md) compiler option is specified. Otherwise, undefined.
4444

@@ -244,8 +244,9 @@ 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 version number of the Microsoft C/C++ compiler is 15.00.20706.01, the `_MSC_FULL_VER` macro evaluates to 150020706. Enter `cl /?` at the command line to view the compiler's version number. This macro is always defined. `_MSC_FULL_VER` must be used to distinguish between Visual Studio 2019 16.8 and 16.9 because those versions share the same major and minor versions (and `_MSC_VER`). The same is true for Visual Studio 2019 16.10 and 16.11.
248-
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.
248+
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.
249+
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.
249250
- `_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.
250251
251252
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.
@@ -262,7 +263,8 @@ MSVC supports other predefined macros:
262263
#endif
263264
```
264265

265-
To test for compiler versions that share major and minor numbers, use the major, minor, and build numbers in `_MSC_FULL_VER` for comparisons. The compilers in Visual Studio 2019 version 16.9 have an `_MSC_FULL_VER` value of 192829500 or greater. The compilers in Visual Studio 2019 version 16.11 have an `_MSC_FULL_VER` value of 192930100 or greater.
266+
To test for compiler versions that share major and minor numbers, use the major, minor, and build numbers in `_MSC_FULL_VER` for comparisons. `_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.
267+
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 Visual Studio 2019 16.10 is 192929917. The minimum value of `_MSC_FULL_VER` for Visual Studio 2019 16.11 is 192930129.
266268

267269
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.
268270

@@ -315,9 +317,9 @@ MSVC supports other predefined macros:
315317
316318
No preprocessor macros that identify the ATL or MFC library version are predefined by the compiler. ATL and MFC library headers define these version macros internally. They're undefined in preprocessor directives made before the required header is included.
317319
318-
- `_ATL_VER` Defined in \<atldef.h> as an integer literal that encodes the ATL version number.
320+
- `_ATL_VER` Defined in `<atldef.h>` as an integer literal that encodes the ATL version number.
319321
320-
- `_MFC_VER` Defined in \<afxver_.h> as an integer literal that encodes the MFC version number.
322+
- `_MFC_VER` Defined in `<afxver_.h>` as an integer literal that encodes the MFC version number.
321323
322324
## See also
323325

0 commit comments

Comments
 (0)