Skip to content

Commit c77df21

Browse files
author
Colin Robertson
authored
Merge pull request #3183 from MicrosoftDocs/master637587699054412677
Repo sync for protected CLA branch
2 parents b3811ee + e07ed5c commit c77df21

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

docs/build/reference/await-enable-coroutine-support.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,35 @@ f1_keywords: ["/await", "-await"]
66
helpviewer_keywords: ["/await enable coroutine support [C++]", "-await enable coroutine support [C++]", "await enable coroutine support [C++]"]
77
ms.assetid: 302c8e69-09b6-4c58-bcdd-0a6a8713a8df
88
---
9-
# /await (Enable coroutine support)
9+
# `/await` (Enable coroutine support)
1010

11-
Use the **/await** compiler option to enable compiler support for coroutines.
11+
Use the **`/await`** compiler option to enable compiler support for coroutines.
1212

1313
## Syntax
1414

15-
> /await
15+
> **`/await`**\
16+
> **`/await:strict`**
1617
1718
## Remarks
1819

19-
The **/await** compiler option enables compiler support for C++ coroutines and the keywords **`co_await`**, **`co_yield`**, and **`co_return`**. This option is off by default. For information about support for coroutines in Visual Studio, see the [Visual Studio Team Blog](https://devblogs.microsoft.com/cppblog/category/coroutine/). For more information about the coroutines standard proposal, see [N4628 Working Draft, Technical Specification for C++ Extensions for Coroutines](https://wg21.link/n4628).
20+
The **`/await`** compiler option enables compiler support for C++ coroutines and the keywords **`co_await`**, **`co_yield`**, and **`co_return`**. This option is off by default. For information about support for coroutines in Visual Studio, see the [Visual Studio Team Blog](https://devblogs.microsoft.com/cppblog/category/coroutine/). For more information about the coroutines standard proposal, see [N4628 Working Draft, Technical Specification for C++ Extensions for Coroutines](https://wg21.link/n4628).
2021

21-
The **/await** option is available beginning in Visual Studio 2015.
22+
The **`/await`** option is available beginning in Visual Studio 2015.
23+
24+
Starting in Visual Studio 2019 version 16.10, the **`/await:strict`** option can be used in place of **`/await`**. The option provides C++20-compatible coroutine support in projects that build in C++14 or C++17 mode. In **`/await:strict`** mode, library support is provided in \<coroutine> and in the `std` namespace.
25+
26+
The **`/await:strict`** option disables language extensions present in **`/await`** that weren't adopted into the C++20 standard. Use of such features results in a compiler error. The option also implements coroutine behaviors such as promise parameter preview. These behaviors aren't available under **`/await`** because of binary compatibility issues in older versions of Visual Studio.
27+
28+
> [!NOTE]
29+
> Coroutine state objects obtained from `coroutine_handle<T>::address()` aren't compatible between **`/await`** and **`/await:strict`** modes. Use of `coroutine_handle<T>::from_address()` on an address obtained from a coroutine handle created by code compiled in an incompatible mode results in undefined behavior.
2230
2331
### To set this compiler option in the Visual Studio development environment
2432

2533
1. Open your project's **Property Pages** dialog box.
2634

2735
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
2836

29-
1. Enter the **/await** compiler option in the **Additional Options** box. Choose **OK** or **Apply** to save your changes.
37+
1. Enter the **`/await`** or **`/await:strict`** compiler option in the **Additional Options** box. Choose **OK** or **Apply** to save your changes.
3038

3139
### To set this compiler option programmatically
3240

0 commit comments

Comments
 (0)