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
The Microsoft Visual C++ compiler version consists of a four-part major and minor version number. The compiler version is reflected in the [`_MSC_VER`](../preprocessor/predefined-macros.md) macro as a number, such as 1938, and can be used to distinguish between different versions of the compiler.
11
+
The Microsoft Visual C++ compiler version consists of a four-part major and minor version number. The compiler version is reflected in the [`_MSC_VER`](../preprocessor/predefined-macros.md) macro as a number, such as 1938. It is used to distinguish between different versions of the compiler.
12
12
13
13
## A brief history of Visual C++ compiler versioning
14
14
15
15
### Visual Studio 6.0 through Visual Studio 2015 (14.0)
16
16
17
17
- For major releases, `_MSC_VER` increases by 100. `_MSC_FULL_VER` increases by 10,000,000.
18
18
- For minor releases, `_MSC_VER` increases by 10. `_MSC_FULL_VER` increases by 1,000,000.
19
+
19
20
Note: Visual Studio .NET 2003 was considered a minor release.
20
21
21
22
### Visual Studio 2017
22
23
23
24
- For major releases, the minor version increases by 10.
24
-
- Starting with Visual Studio 2017 version 15.3, each minor update increases the minor version by 1.
25
+
- Starting with Visual Studio 2017 version 15.3, the minor version increases by 1.
25
26
26
27
### Service releases starting with Visual Studio 2017
27
28
28
-
- Distinguish servicing releases using `_MSC_FULL_VER`. The build field (the 3rd element of the period-delimited version number) typically increases by 1.
29
+
- Distinguish servicing releases using `_MSC_FULL_VER`. The build field (the third element of the period-delimited version number) typically increases by 1.
29
30
- 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. The same is true for distinguishing Visual Studio 2019 16.10 and 16.11.
30
31
31
-
## Summary of macros
32
+
## Version macros
32
33
33
-
-[`_MSC_VER`](../preprocessor/predefined-macros.md) distinguishes between different versions of the compiler at a high level. It is used to distinguish between major and minor releases.
34
-
-[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md) represents the major, minor, and build version of the compiler. It is 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.
34
+
-[`_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.
35
+
-[`_MSC_FULL_VER`](../preprocessor/predefined-macros.md) represents the major, minor, and build version of the compiler. 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.
35
36
-[`_MSC_BUILD`](../preprocessor/predefined-macros.md) represents the build version of the compiler. Use it to distinguish between servicing releases.
36
37
37
38
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 17.1 to 17.2, when `_MSC_VER` changed from 1931 to 1932.
@@ -79,6 +80,7 @@ The following table lists the Visual C++ compiler `_MSC_VER` for each Visual Stu
79
80
| Visual Studio 2022 version 17.10 | 1940 |
80
81
81
82
<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 192829913.
83
+
82
84
<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 ???. `MSC_FULL_VER` for 16.11 is 192930133.
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.
14
14
15
-
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. Some macros are defined only for specific build environments or compiler options. Except where noted, the macros are defined throughout a translation unit as if they were specified as **`/D`** compiler option arguments. When defined, the macros are expanded to the specified values by the preprocessor before compilation. The predefined macros take no arguments and can't be redefined.
15
+
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.
16
+
17
+
Some macros are defined only for specific build environments or compiler options. Except where noted, the macros are defined throughout a translation unit as if they were specified as **`/D`** compiler option arguments. When defined, the preprocessor expands macros their specified values before compilation. The predefined macros take no arguments and can't be redefined.
16
18
17
19
## Standard predefined identifier
18
20
@@ -38,7 +40,7 @@ The compiler supports these predefined macros specified by the ISO C99, C11, C17
38
40
39
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.
40
42
41
-
-`__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 also 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.
43
+
-`__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.
42
44
43
45
-`__STDC_HOSTED__` Defined as 1 if the implementation is a *hosted implementation*, one that supports the entire required standard library. Otherwise, defined as 0.
44
46
@@ -262,7 +264,7 @@ MSVC supports other predefined macros:
262
264
263
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.
264
266
265
-
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 compiler versioning, see [Visual C++ Compiler Version](https://devblogs.microsoft.com/cppblog/visual-c-compiler-version/) in the Microsoft C++ Team Blog.
266
268
267
269
-`_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.
0 commit comments