Skip to content

Commit a0e1f39

Browse files
author
mikeblome
committed
updates per tech review
1 parent b56b471 commit a0e1f39

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

docs/cpp/import-export-module.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ title: "module, import, export"
33
ms.date: "12/12/2019"
44
f1_keywords: ["module_cpp", "import_cpp", "export_cpp"]
55
helpviewer_keywords: ["modules [C++]", "modules [C++], import", "modules [C++], export"]
6-
description: Use the import and export statements to access and to publish types and functions defined in the specified module.
6+
description: Use import and export declarations to access and to publish types and functions defined in the specified module.
77
---
88

99
# module, import, export
1010

11-
The **module**, **import**, and **export** keywords are available in C++20 and require the [/experimental:module](../build/reference/experimental-module.md) compiler switch along with [/std:c++latest](../build/reference/std-specify-language-standard-version.md). For more information, see [Overview of modules in C++](modules-cpp.md).
11+
The **module**, **import**, and **export** declarations are available in C++20 and require the [/experimental:module](../build/reference/experimental-module.md) compiler switch along with [/std:c++latest](../build/reference/std-specify-language-standard-version.md). For more information, see [Overview of modules in C++](modules-cpp.md).
1212

1313
## module
1414

15-
Use the **module** statement at the beginning of a module implementation file to specify that the file contents belong to the named module.
15+
Place a **module** declaration at the beginning of a module implementation file to specify that the file contents belong to the named module.
1616

1717
```cpp
1818
module ModuleA;
1919
```
2020

2121
## export
2222

23-
Use the **export module** statement for the module's primary interface file, which must have extension **.ixx**:
23+
Use an **export module** declaration for the module's primary interface file, which must have extension **.ixx**:
2424

2525
```cpp
2626
export module ModuleA;
@@ -55,11 +55,11 @@ void main() {
5555
}
5656
```
5757

58-
The **export** keyword may not appear in a module implementation file. When the **export** modifier is applied to a namespace name, all names in the namespace are exported.
58+
The **export** keyword may not appear in a module implementation file. When **export** is applied to a namespace name, all names in the namespace are exported.
5959

6060
## import
6161

62-
Use the **import** statement to make a module's names visible in your program. The import statement must appear after the module statement and after any #include directives, but before any declarations in the file.
62+
Use an **import** declaration to make a module's names visible in your program. The import declaration must appear after the module declaration and after any #include directives, but before any declarations in the file.
6363

6464
```cpp
6565
module ModuleA;
@@ -77,21 +77,26 @@ class Baz
7777
7878
## Remarks
7979
80-
Both **import** and **module** are contextual keywords. They are treated as keywords only when they appear on one of these lines:
80+
Both **import** and **module** are treated as keywords only when they appear at the start of a logical line:
8181
8282
```cpp
83+
84+
// OK:
8385
module ;
84-
module <identifier>
86+
module module-name
8587
import :
8688
import <
8789
import "
88-
import <identifier>
90+
import module-name
8991
export module ;
90-
export module <identifier>
92+
export module module-name
9193
export import :
9294
export import <
9395
export import "
94-
export import <identifier>
96+
export import module-name
97+
98+
// Error:
99+
int i; module ;
95100
```
96101

97102
**Microsoft Specific**

docs/cpp/modules-cpp.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Overview of modules in C++"
3-
ms.date: "07/23/2019"
3+
ms.date: "12/13/2019"
44
helpviewer_keywords: ["modules [C++]", "modules [C++], overview"]
55
description: Modules in C++20 provide a modern alternative to header files.
66
---
@@ -27,14 +27,14 @@ Although not specified by the C++20 standard, Microsoft enables its implementati
2727
- std.threading provides the contents of headers \<atomic>, \<condition_variable>, \<future>, \<mutex>, \<shared_mutex>, and \<thread>
2828
- std.core provides everything else in the C++ Standard Library
2929

30-
To consume these modules, just add an import statement to the top of the source code file. For example:
30+
To consume these modules, just add an import declaration to the top of the source code file. For example:
3131

3232
```cpp
3333
import std.core;
3434
import std.regex;
3535
```
3636

37-
To consume the Microsoft Standard Library module, you must compile your program with [/EHsc](../build/reference/eh-exception-handling-model.md) and [/MD](../build/reference/md-mt-ld-use-run-time-library.md) options.
37+
To consume the Microsoft Standard Library module, compile your program with [/EHsc](../build/reference/eh-exception-handling-model.md) and [/MD](../build/reference/md-mt-ld-use-run-time-library.md) options.
3838

3939
## Basic example
4040

@@ -57,7 +57,7 @@ namespace Bar
5757
}
5858
```
5959

60-
The file **MyProgram.cpp** uses the **import** statement to access the name that is exported by `Foo`. Note that the name `Bar` is visible here, but not all of its members. Also note that the macro `ANSWER` is not visible.
60+
The file **MyProgram.cpp** uses the **import** declaration to access the name that is exported by `Foo`. Note that the name `Bar` is visible here, but not all of its members. Also note that the macro `ANSWER` is not visible.
6161

6262
```cpp
6363

0 commit comments

Comments
 (0)