Skip to content

Commit 2147f61

Browse files
TylerMSFTTylerMSFT
authored andcommitted
address github #4319
1 parent dcb855a commit 2147f61

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/cpp/tutorial-import-stl-named-module.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Tutorial: Import the standard library (STL) using modules (C++)"
3-
ms.date: 12/01/2022
3+
ms.date: 12/02/2022
44
ms.topic: "tutorial"
55
author: "tylermsft"
66
ms.author: "twhitney"
@@ -205,15 +205,15 @@ Versioning for named modules is the same as for headers. The `.ixx` named module
205205
206206
Don't mix and match importing header units and named modules. That is, don't `import <vector>;` and `import std;` in the same file, for example. You'll get a compiler error.
207207
208-
Don't mix and match importing header units and name modules. That is, don't `#include <vector>` and `import std;` in the same file, for example.
208+
Don't mix and match importing C++ standard library header files and named modules. That is, don't `#include <vector>` and `import std;` in the same file, for example. However, you can include C headers and import named modules in the same file. For example, you can `#include <math.h>`, though you shouldn't include the C++ standard library version `<cmath>`.
209209
210-
You don't have to defend against importing a module multiple times. No header guard `#ifndef` required. The compiler knows when it has already imported a named module and ignores duplicate attempts to do so.
210+
You don't have to defend against importing a module multiple times: no header guard `#ifndef` required. The compiler knows when it has already imported a named module and ignores duplicate attempts to do so.
211211
212212
If you need to use the `assert()` macro, then `#include <assert.h>`.
213213
214-
If you need to use the `errno` macro, `#include <assert.h>`. Because named modules don't expose macros, this is the workaround if you need to check for errors from `<cmath>` functions.
214+
If you need to use the `errno` macro, `#include <errno.h>`. Because named modules don't expose macros, this is the workaround if you need to check for errors from `<math.h>`, for example.
215215
216-
`INT_MIN` is defined by `<limits.h>` and `<climits>` and works with header files/header units. However, those two headers won't work as a named module because named modules don't expose macros. You can use `std::numeric_limits<int>::min()` instead.
216+
Macros such as `NAN`, `INFINITY`, and `INT_MIN` are defined by `<limits.h>`, which you could include. However, if you use `import std;`, you can use `numeric_limits<double>::quiet_NaN()` and `numeric_limits<double>::infinity()` instead of `NAN` and `INFINITY`, and `std::numeric_limits<int>::min()` instead of `INT_MIN`.
217217
218218
## Summary
219219

0 commit comments

Comments
 (0)