Skip to content

Commit bf64548

Browse files
author
Colin Robertson
authored
Merge pull request MicrosoftDocs#3840 from MicrosoftDocs/main637859005839350919
Repo sync for protected CLA branch
2 parents cb60690 + 94af18c commit bf64548

File tree

6 files changed

+126
-25
lines changed

6 files changed

+126
-25
lines changed

docs/build/reference/compiler-options-listed-alphabetically.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Compiler options listed alphabetically"
33
description: "Reference listing in alphabetical order of the Microsoft C/C++ compiler command-line options."
4-
ms.date: 12/15/2021
4+
ms.date: 04/15/2022
55
helpviewer_keywords: ["compiler options, C++"]
66
---
77
# Compiler options listed alphabetically
@@ -112,6 +112,8 @@ This table contains an alphabetical list of compiler options. For a list of comp
112112
| [`/hotpatch`](hotpatch-create-hotpatchable-image.md) | Creates a hotpatchable image. |
113113
| [`/I<dir>`](i-additional-include-directories.md) | Searches a directory for include files. |
114114
| **`/ifcOutput`** | Specify output file or directory for *`.ifc`* files. |
115+
| [`/interface`](interface.md) | Treat the input file as a module interface unit. |
116+
| [`/internalPartition`](internal-partition.md) | Treat the input file as an internal partition unit. |
115117
| [`/J`](j-default-char-type-is-unsigned.md) | Changes the default **`char`** type. |
116118
| [`/JMC`](jmc.md) | Supports native C++ Just My Code debugging. |
117119
| [`/kernel`](kernel-create-kernel-mode-binary.md) | The compiler and linker will create a binary that can be executed in the Windows kernel. |
@@ -161,7 +163,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
161163
| [`/RTCs`](rtc-run-time-error-checks.md) | Enable stack frame runtime checks. |
162164
| [`/RTCu`](rtc-run-time-error-checks.md) | Enables uninitialized local usage checks. |
163165
| [`/scanDependencies`](scandependencies.md) | List module dependencies in C++ Standard JSON form. |
164-
| [`/sdl`](sdl-enable-additional-security-checks.md) | Enable additional security features and warnings. |
166+
| [`/sdl`](sdl-enable-additional-security-checks.md) | Enable more security features and warnings. |
165167
| [`/showIncludes`](showincludes-list-include-files.md) | Displays a list of all include files during compilation. |
166168
| [`/source-charset`](source-charset-set-source-character-set.md) | Set source character set. |
167169
| [`/sourceDependencies`](sourcedependencies.md) | List all source-level dependencies. |

docs/build/reference/compiler-options-listed-by-category.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Compiler Options Listed by Category"
33
description: "Reference listing by category of the Microsoft C/C++ compiler command-line options."
4-
ms.date: 12/15/2021
4+
ms.date: 04/15/2022
55
helpviewer_keywords: ["compiler options, C++"]
66
ms.assetid: c4750dcf-dba0-4229-99b6-45cdecc11729
77
---
@@ -130,14 +130,16 @@ This article contains a categorical list of compiler options. For an alphabetica
130130
| [`/u`](u-u-undefine-symbols.md) | Removes all predefined macros. |
131131
| [`/X`](x-ignore-standard-include-paths.md) | Ignores the standard include directory. |
132132

133-
## Header units
133+
## Header units/modules
134134

135135
| Option | Purpose |
136136
|--|--|
137137
| [`/exportHeader`](module-exportheader.md) | Create the header units files (*`.ifc`*) specified by the input arguments. |
138138
| [`/headerUnit`](headerunit.md) | Specify where to find the header unit file (*`.ifc`*) for the specified header. |
139139
| [`/headerName`](headername.md) | Build a header unit from the specified header. |
140140
| **`/ifcOutput`** | Specify output file or directory for *`.ifc`* files. |
141+
| [`/interface`](interface.md) | Treat the input file as a module interface unit. |
142+
| [`/internalPartition`](internal-partition.md) | Treat the input file as an internal partition unit. |
141143
| [`/reference`](module-reference.md) | Use named module IFC. |
142144
| [`/scanDependencies`](scandependencies.md) | List module and header unit dependencies in C++ Standard JSON form. |
143145
| [`/sourceDependencies`](sourcedependencies.md) | List all source-level dependencies. |
@@ -274,7 +276,7 @@ This article contains a categorical list of compiler options. For an alphabetica
274276
| [`/external:templates[-]`](external-external-headers-diagnostics.md) | Evaluate warning level across template instantiation chain. |
275277
| [`/external:W<n>`](external-external-headers-diagnostics.md) | Set warning level for external headers. |
276278
| [`/options:strict`](options-strict.md) | Unrecognized compiler options are errors. |
277-
| [`/sdl`](sdl-enable-additional-security-checks.md) | Enable additional security features and warnings. |
279+
| [`/sdl`](sdl-enable-additional-security-checks.md) | Enable more security features and warnings. |
278280
| [`/w`](compiler-option-warning-level.md) | Disable all warnings. |
279281
| [`/W0`, `/W1`, `/W2`, `/W3`, `/W4`](compiler-option-warning-level.md) | Set output warning level. |
280282
| [`/w1<n>`, `/w2<n>`, `/w3<n>`, `/w4<n>`](compiler-option-warning-level.md) | Set warning level for the specified warning. |

docs/build/reference/interface.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "/interface"
3+
description: "Use the /interface compiler option to treat the input file as a module interface unit."
4+
ms.date: 04/15/2022
5+
author: "tylermsft"
6+
ms.author: "twhitney"
7+
f1_keywords: ["/interface", "VC.Project.VCCLCompilerTool.Interface"]
8+
helpviewer_keywords: ["/interface", "Translate include directives into import directives"]
9+
---
10+
# `/interface`
11+
12+
This switch instructs the compiler to treat the input file on the command line as a module interface unit.
13+
14+
## Syntax
15+
16+
> **`/interface`** *`filename`*
17+
18+
## Remarks
19+
20+
Use this switch when a module interface has a different extension than `.ixx`.
21+
22+
In the following example, the module interface has a `.cppm` extension instead of `.ixx`, so the `/interface` switch is used to compile it as a module interface:
23+
24+
```bash
25+
cl /c /std:c++latest /interface /TP my-module.cppm
26+
```
27+
28+
The compiler derives the name for the generated `.ifc` file from the module interface name. For example, given a module name `MyModule` defined in `my-module.cppm`, the generated `.ifc` will be named `MyModule.ifc`.
29+
30+
This switch must be used in with the [`/TP` (Specify source file type)](tc-tp-tc-tp-specify-source-file-type.md) compiler flag.
31+
32+
**`/interface`** is available in Visual Studio 2019 version 16.10, or later.\
33+
**`/interface`** requires [/std:c++20](std-specify-language-standard-version.md) or later.
34+
35+
## See also
36+
37+
[Overview of modules in C++](../../cpp/modules-cpp.md)\
38+
[Using C++ Modules in MSVC from the Command Line](https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: "/internalPartition"
3+
description: "Use the /internalPartition compiler option to treat the input file as an internal partition unit."
4+
ms.date: 04/15/2022
5+
author: "tylermsft"
6+
ms.author: "twhitney"
7+
f1_keywords: ["/internalPartition", "VC.Project.VCCLCompilerTool.Interface"]
8+
helpviewer_keywords: ["/internalPartition", "Translate include directives into import directives"]
9+
---
10+
# `/internalPartition`
11+
12+
Use this switch to treat the input file on the command line as an [internal partition unit](http://eel.is/c%2B%2Bdraft/module#unit-4.3).
13+
14+
## Syntax
15+
16+
> **`/internalPartition`** *`filename`*
17+
18+
## Remarks
19+
20+
The following example demonstrates using the `/internalPartition` switch:
21+
22+
`m-internals.cpp`:
23+
24+
```cpp
25+
module m:internals;
26+
27+
void internalFunc() {} // cannot have `export` since this is an internal partition
28+
```
29+
30+
`m.ixx`:
31+
32+
```cpp
33+
export module m;
34+
import :internals; // Cannot export this partition.
35+
36+
export
37+
void wrapper() { internalFunc(); }
38+
```
39+
40+
To compile this interface:
41+
42+
```bash
43+
cl /std:c++latest /internalPartition /c m-internals.cpp
44+
```
45+
46+
This switch can't be used with the [`/interface`](interface.md) compiler switch.
47+
48+
**`/internalPartition`** is available in Visual Studio 2019 version 16.10, or later.\
49+
**`/internalPartition`** requires [/std:c++20](std-specify-language-standard-version.md) or later.
50+
51+
## See also
52+
53+
[Overview of modules in C++](../../cpp/modules-cpp.md)\
54+
[Using C++ Modules in MSVC from the Command Line](https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/)\
55+
[C++ Modules conformance improvements with MSVC in Visual Studio 2019 16.5](https://devblogs.microsoft.com/cppblog/c-modules-conformance-improvements-with-msvc-in-visual-studio-2019-16-5/#module-partitions)

docs/build/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ items:
621621
href: ../build/reference/hotpatch-create-hotpatchable-image.md
622622
- name: /I (Additional include directories)
623623
href: ../build/reference/i-additional-include-directories.md
624+
- name: /interface (treat input file as a module interface unit)
625+
href: ../build/reference/interface.md
626+
- name: /internalPartition (treat the input file as an internal partition unit.)
627+
href: ../build/reference/internal-partition.md
624628
- name: /J (Default char type is unsigned)
625629
href: ../build/reference/j-default-char-type-is-unsigned.md
626630
- name: /JMC (Just My Code debugging)

docs/extensions/interface-class-cpp-component-extensions.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
2-
description: "Learn more about: interface class (C++/CLI and C++/CX)"
2+
description: "Learn more about: interface class (C++/CLI and C++/CX)"
33
title: "interface class (C++/CLI and C++/CX)"
4-
ms.date: "10/12/2018"
4+
ms.date: 04/15/2022
55
ms.topic: "reference"
6-
f1_keywords: ["interface_CPP"]
6+
f1_keywords: ["interface_CPP", "interface class", "interface class_CPP"]
77
helpviewer_keywords: ["interface class keyword", "interface struct keyword"]
88
ms.assetid: 3ccea701-f50b-4da7-ad6b-f0ee1203e2b9
99
---
10-
# interface class (C++/CLI and C++/CX)
10+
# `interface class` (C++/CLI and C++/CX)
1111

12-
Declares an interface. For information on native interfaces, see [__interface](../cpp/interface.md).
12+
Declares an interface. For information on native interfaces, see [`__interface`](../cpp/interface.md).
1313

14-
## All Runtimes
14+
## All runtimes
1515

1616
### Syntax
1717

@@ -22,39 +22,39 @@ interface_access interface struct name : inherit_access base_interface {};
2222
2323
### Parameters
2424
25-
*interface_access*<br/>
26-
The accessibility of an interface outside the assembly. Possible values are **`public`** and **`private`**. **`private`** is the default. Nested interfaces cannot have an *interface_access* specifier.
25+
*`interface_access`*\
26+
The accessibility of an interface outside the assembly. Possible values are **`public`** and **`private`**. **`private`** is the default. Nested interfaces can't have an *`interface_access`* specifier.
2727
28-
*name*<br/>
28+
*`name`*\
2929
The name of the interface.
3030
31-
*inherit_access*<br/>
32-
The accessibility of *base_interface*. The only permitted accessibility for a base interface is **`public`** (the default).
31+
*`inherit_access`*\
32+
The accessibility of *`base_interface`*. The only permitted accessibility for a base interface is **`public`** (the default).
3333
34-
*base_interface*<br/>
35-
(Optional) A base interface for interface *name*.
34+
*`base_interface`*\
35+
(Optional) A base interface for interface *`name`*.
3636
3737
### Remarks
3838
39-
**interface struct** is equivalent to **interface class**.
39+
**`interface struct`** is equivalent to **`interface class`**.
4040
4141
An interface can contain declarations for functions, events, and properties. All interface members have public accessibility. An interface can also contain static data members, functions, events, and properties, and these static members must be defined in the interface.
4242
43-
An interface defines how a class may be implemented. An interface is not a class and classes can only implement interfaces. When a class defines a function declared in an interface, the function is implemented, not overridden. Therefore, name lookup does not include interface members.
43+
An interface defines how a class may be implemented. An interface isn't a class and classes can only implement interfaces. When a class defines a function declared in an interface, the function is implemented, not overridden. Therefore, name lookup doesn't include interface members.
4444
45-
A class or struct that derives from an interface must implement all members of the interface. When implementing interface *name* you must also implement the interfaces in the `base_interface` list.
45+
A `class` or `struct` that derives from an interface must implement all members of the interface. When implementing interface *`name`*, you must also implement the interfaces in the *`base_interface`* list.
4646
4747
For more information, see:
4848
49-
- [Interface Static Constructor](../dotnet/how-to-define-an-interface-static-constructor-cpp-cli.md)
49+
- [Interface static constructor](../dotnet/how-to-define-an-interface-static-constructor-cpp-cli.md)
5050
51-
- [Generic Interfaces (C++/CLI)](generic-interfaces-visual-cpp.md)
51+
- [Generic interfaces (C++/CLI)](generic-interfaces-visual-cpp.md)
5252
5353
For information on other CLR types, see [Classes and Structs](classes-and-structs-cpp-component-extensions.md).
5454
55-
You can detect at compile time if a type is an interface with `__is_interface_class(type)`. For more information, see [Compiler Support for Type Traits](compiler-support-for-type-traits-cpp-component-extensions.md).
55+
You can detect at compile time if a type is an interface with `__is_interface_class(type)`. For more information, see [Compiler support for type traits](compiler-support-for-type-traits-cpp-component-extensions.md).
5656
57-
In the development environment, you can get F1 help on these keywords by highlighting the keyword, (**`interface class`**, for example) and pressing F1.
57+
In the development environment, you can get F1 help on these keywords by highlighting the keyword (for example, **`interface class`**) and pressing **F1**.
5858
5959
## Windows Runtime
6060

0 commit comments

Comments
 (0)