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/overview/what-s-new-for-visual-cpp-in-visual-studio.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -251,7 +251,7 @@ The MSVC compiler toolset in Visual Studio version 15.7 now conforms with the C+
251
251
252
252
##### Visual Studio 2017 version 15.8
253
253
254
-
The [`/experimental:preprocessor`](../build/reference/experimental-preprocessor.md) compiler switch enables the new experimental MSVC preprocessor that will eventually conform to all applicable C and C++ standards. For more information, see [MSVC experimental preprocessor overview](../preprocessor/preprocessor-experimental-overview.md).
254
+
The [`/experimental:preprocessor`](../build/reference/experimental-preprocessor.md) compiler switch enables the new experimental MSVC preprocessor that will eventually conform to all applicable C and C++ standards. For more information, see [MSVC new preprocessor overview](../preprocessor/preprocessor-experimental-overview.md).
The *C/C++ preprocessor reference* explains the preprocessor as it is implemented in Microsoft C/C++. The preprocessor performs preliminary operations on C and C++ files before they are passed to the compiler. You can use the preprocessor to conditionally compile code, insert files, specify compile-time error messages, and apply machine-specific rules to sections of code.
10
10
11
-
In Visual Studio 2019 the [/experimental:preprocessor](../build/reference/experimental-preprocessor.md) compiler option enables a new implementation of the preprocessor. The new implementation is still in progress, and is therefore considered experimental. It is intended to eventually be conformant with C99, C11, and C++20. For more information, see [MSVC experimental preprocessor overview](preprocessor-experimental-overview.md).
11
+
In Visual Studio 2019 the [/experimental:preprocessor](../build/reference/experimental-preprocessor.md) compiler option enables a new implementation of the preprocessor. The new implementation is still in progress, and is therefore considered experimental. It is intended to eventually be conformant with C99, C11, and C++20. For more information, see [MSVC new preprocessor overview](preprocessor-experimental-overview.md).
Visual Studio 2015 uses the traditional preprocessor, which doesn't conform with Standard C++. An experimental preprocessor is available in Visual Studio 2017 and Visual Studio 2019 by using the [/experimental:preprocessor](../build/reference/experimental-preprocessor.md) compiler switch. More information about using the new preprocessor in Visual Studio 2017 and Visual Studio 2019 is available. To see the documentation for your preferred version of Visual Studio, use the **Version** selector control. It's found at the top of the table of contents on this page.
11
+
Visual Studio 2015 uses the traditional preprocessor, which doesn't conform with Standard C++ or C99. Starting in Visual Studio 2019 version 16.5, new preprocessor support for the C++20 standard is feature-complete. These changes are available by using the [/Zc:preprocessor](../build/reference/zc-preprocessor.md) compiler switch. An experimental version of the new preprocessor is available starting in Visual Studio 2017 version 15.8 and later by using the [/experimental:preprocessor](../build/reference/experimental-preprocessor.md) compiler switch. More information about using the new preprocessor in Visual Studio 2017 and Visual Studio 2019 is available. To see the documentation for your preferred version of Visual Studio, use the **Version** selector control. It's found at the top of the table of contents on this page.
12
12
13
13
::: moniker-end
14
14
15
15
::: moniker range=">=vs-2017"
16
16
17
17
We're updating the Microsoft C++ preprocessor to improve standards conformance, fix longstanding bugs, and change some behaviors that are officially undefined. We've also added new diagnostics to warn on errors in macro definitions.
18
18
19
-
Starting in Visual Studio 2019 version 16.5, preprocessor support for the C++20 standard is feature-complete. These changes are available starting in Visual Studio 2019 version 16.5 by using the [/Zc:preprocessor](../build/reference/zc-preprocessor.md) compiler switch. An experimental version is available in earlier versions starting in Visual Studio 2017 version 15.8 by using the [/experimental:preprocessor](../build/reference/experimental-preprocessor.md) compiler switch. The default preprocessor behavior remains the same as in previous versions.
19
+
Starting in Visual Studio 2019 version 16.5, preprocessor support for the C++20 standard is feature-complete. These changes are available by using the [/Zc:preprocessor](../build/reference/zc-preprocessor.md) compiler switch. An experimental version of the new preprocessor is available in earlier versions starting in Visual Studio 2017 version 15.8. You can enable it by using the [/experimental:preprocessor](../build/reference/experimental-preprocessor.md) compiler switch. The default preprocessor behavior remains the same as in previous versions.
20
20
21
21
## New predefined macro
22
22
@@ -30,9 +30,9 @@ You can detect which preprocessor is in use at compile time. Check the value of
30
30
#endif
31
31
```
32
32
33
-
## Behavior changes in the experimental preprocessor
33
+
## Behavior changes in the new preprocessor
34
34
35
-
The initial work on the experimental preprocessor has been focused on making all macro expansions conform to the standard. It lets you use the MSVC compiler with libraries that are currently blocked by the traditional behaviors. We tested the updated preprocessor on real world projects. Here are some of the more common breaking changes we found:
35
+
The initial work on the new preprocessor has been focused on making all macro expansions conform to the standard. It lets you use the MSVC compiler with libraries that are currently blocked by the traditional behaviors. We tested the updated preprocessor on real world projects. Here are some of the more common breaking changes we found:
36
36
37
37
### Macro comments
38
38
@@ -120,7 +120,7 @@ ADD_STD(string) s;
120
120
121
121
### Comma elision in variadic macros
122
122
123
-
The traditional MSVC preprocessor always removes commas before empty `__VA_ARGS__` replacements. The experimental preprocessor more closely follows the behavior of other popular cross-platform compilers. For the comma to be removed, the variadic argument must be missing (not just empty) and it must be marked with a `##` operator. Consider the following example:
123
+
The traditional MSVC preprocessor always removes commas before empty `__VA_ARGS__` replacements. The new preprocessor more closely follows the behavior of other popular cross-platform compilers. For the comma to be removed, the variadic argument must be missing (not just empty) and it must be marked with a `##` operator. Consider the following example:
124
124
125
125
```cpp
126
126
void func(int, int = 2, int = 3);
@@ -154,11 +154,11 @@ int main()
154
154
}
155
155
```
156
156
157
-
In the upcoming C++20 standard, this issue has been addressed by adding `__VA_OPT__`. Experimental preprocessor support for `__VA_OPT__` is available starting in Visual Studio 2019 version 16.5.
157
+
In the upcoming C++20 standard, this issue has been addressed by adding `__VA_OPT__`. New preprocessor support for `__VA_OPT__` is available starting in Visual Studio 2019 version 16.5.
158
158
159
159
### C++20 variadic macro extension
160
160
161
-
The experimental preprocessor supports C++20 variadic macro argument elision:
161
+
The new preprocessor supports C++20 variadic macro argument elision:
162
162
163
163
```cpp
164
164
#define FUNC(a, ...) __VA_ARGS__ + a
@@ -169,7 +169,7 @@ int main()
169
169
}
170
170
```
171
171
172
-
This code isn't conforming before the C++20 standard. In MSVC, the experimental preprocessor extends this C++20 behavior to lower language standard modes (**`/std:c++14`**, **`/std:c++17`**). This extension matches the behavior of other major cross-platform C++ compilers.
172
+
This code isn't conforming before the C++20 standard. In MSVC, the new preprocessor extends this C++20 behavior to lower language standard modes (**`/std:c++14`**, **`/std:c++17`**). This extension matches the behavior of other major cross-platform C++ compilers.
173
173
174
174
### Macro arguments are "unpacked"
175
175
@@ -211,7 +211,9 @@ DO_THING(1, "World");
211
211
// IMPL1 ( "Hello","World");
212
212
```
213
213
214
-
Although this example may seem a bit contrived, we've seen it in real world code. To see what's going on, we can break down the expansion starting with `DO_THING`:
214
+
Although this example may seem a bit contrived, we've seen it in real-world code.
215
+
216
+
To see what's going on, we can break down the expansion starting with `DO_THING`:
215
217
216
218
1.`DO_THING(1, "World")` expands to `CAT(IMPL, 1) ECHO(("Hello", "World"))`
217
219
1.`CAT(IMPL, 1)` expands to `IMPL ## 1`, which expands to `IMPL1`
@@ -220,7 +222,7 @@ Although this example may seem a bit contrived, we've seen it in real world code
220
222
1. The preprocessor moves on to the following tokens. It finds the function-like macro `ECHO` gets invoked: `ECHO(("Hello", "World"))`, which expands to `("Hello", "World")`
221
223
1.`IMPL1` is never considered again for expansion, so the full result of the expansions is: `IMPL1("Hello", "World");`
222
224
223
-
To modify the macro to behave the same way under both the experimental preprocessor and the traditional preprocessor, add another layer of indirection:
225
+
To modify the macro to behave the same way under both the new preprocessor and the traditional preprocessor, add another layer of indirection:
224
226
225
227
```cpp
226
228
#defineCAT(a,b) a##b
@@ -238,7 +240,7 @@ DO_THING_FIXED(1, "World");
238
240
239
241
## Incomplete features before 16.5
240
242
241
-
Starting in Visual Studio 2019 version 16.5, the new preprocessor is feature-complete for C++20. In previous versions of Visual Studio, the experimental preprocessor is mostly complete, although some preprocessor directive logic still falls back to the traditional behavior. Here's a partial list of incomplete features in Visual Studio versions before 16.5:
243
+
Starting in Visual Studio 2019 version 16.5, the new preprocessor is feature-complete for C++20. In previous versions of Visual Studio, the new preprocessor is mostly complete, although some preprocessor directive logic still falls back to the traditional behavior. Here's a partial list of incomplete features in Visual Studio versions before 16.5:
0 commit comments