Skip to content

Repo sync for protected branch #5302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/build/reference/experimental-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Enables compiler support for Microsoft's experimental form of C++ Standard modul

## Remarks

This switch was for the time before the new, standardized, way of consuming the C++ Standard Library as modules described in [Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md) was available. Although you can use this switch to use the older experimental named modules, we recommend that you use the new, standardized, way of consuming the C++ Standard Library as modules described in [Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md).
This switch applies to the time before the new, standardized, way of consuming the C++ Standard Library as modules was available. Although you can use this switch to use the older experimental named modules, we recommend that you use the new, standardized, way of consuming the C++ Standard Library as modules described in [Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md).

This compiler became available starting in Visual Studio 2015 Update 1. Ensure that **C++ Modules for v143 build tools (x64/x86 - experimental)** in selected the VS Installer. It's available in the **Individual components** tab of the installer. Search for **experimental** to see the option. For more information, see [Install C and C++ support in Visual Studio](../vscpp-step-0-installation.md).
This compiler switch is available starting in Visual Studio 2015 Update 1. In the VS Installer under the **Individual components** tab, ensure that **C++ Modules for v143 build tools (x64/x86 - experimental)** is selected. You can use the search box with **experimental** to find it. For more information, see [Install C and C++ support in Visual Studio](../vscpp-step-0-installation.md).

| Version | Status |
|---|---|
Expand Down Expand Up @@ -54,6 +54,7 @@ For more information about how to use and create modules, see [Overview of modul

## See also

[Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md)\
[`/headerUnit` (Use header unit IFC)](headerunit.md)\
[`/exportHeader` (Create header units)](module-exportheader.md)\
[`/reference` (Use named module IFC)](module-reference.md)\
Expand Down
9 changes: 4 additions & 5 deletions docs/build/reference/scandependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ Consider the following sample code:
#include <vector>

import other.module;
import std.core;

import std;
import "t.h";

import <iostream>;

int main() {}
Expand All @@ -83,14 +81,14 @@ The compiler produces a JSON file, *`output.json`*, with content similar to:
{
"primary-output": "app.obj",
"outputs": [
"C:\\Users\\username\\source\\repos\\app\\app"
"output.json"
],
"requires": [
{
"logical-name": "other.module"
},
{
"logical-name": "std.core"
"logical-name": "std"
},
{
"logical-name": "t.h",
Expand Down Expand Up @@ -134,6 +132,7 @@ To report module and header unit dependencies, you must also set the **Configura

## See also

[Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md)\
[MSVC compiler options](compiler-options.md)\
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)\
[`/sourceDependencies:directives`](sourcedependencies-directives.md)\
Expand Down
12 changes: 6 additions & 6 deletions docs/build/reference/sourcedependencies-directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ Given the following sample code:
#include <vector>

import m;
import std.core;

import std;
import <utility>;

import "t.h";

int main() {}
Expand All @@ -78,15 +76,16 @@ produces a JSON file *`output.json`* similar to:
{
"Version":"1.1",
"Data":{
"Source":"C:\\a\\b\\main.cpp",
"Source":"C:\\test\\main.cpp",
"ProvidedModule":"",
"ImportedModules":[
"m",
"std.core"
"std"
],
"ImportedHeaderUnits":[
"C:\\...\\utility",
"C:\\a\\b\\t.h"
"C:\\...\\vector",
"C:\\test\\t.h"
]
}
}
Expand All @@ -104,6 +103,7 @@ You normally shouldn't set this option yourself in the Visual Studio development

## See also

[Import the C++ standard library using modules](../../cpp/tutorial-import-stl-named-module.md)\
[`/translateInclude`](translateinclude.md)\
[C++ header-units.json reference](header-unit-json-reference.md)\
[MSVC compiler options](compiler-options.md)\
Expand Down
6 changes: 4 additions & 2 deletions docs/c-runtime-library/floating-point-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ The Universal C Runtime library (UCRT) provides many integral and floating-point

For ISO C Standard 11 (C11) and later, the `<tgmath.h>` header, in addition to including `<math.h>` and `<complex.h>`, provides macros that invoke a corresponding math function based on the types of the parameters. See [Type-generic math](tgmath.md) for details.

Many of the floating point math library functions have different implementations for different CPU architectures. For example, the 32-bit x86 CRT may have a different implementation than the 64-bit x64 CRT. In addition, some of the functions may have multiple implementations for a given CPU architecture. The most efficient implementation is selected dynamically at run-time depending on the instruction sets supported by the CPU. For example, in the 32-bit x86 CRT, some functions have both an x87 implementation and an SSE2 implementation. When running on a CPU that supports SSE2, the faster SSE2 implementation is used. When running on a CPU that doesn't support SSE2, the slower x87 implementation is used. Because different implementations of the math library functions may use different CPU instructions and different algorithms to produce their results, the functions may produce different results across CPUs. In most cases, the results are within +/-1 ULP of the correctly rounded result, but the actual results may vary across CPUs.
Many of the floating-point math library functions have different implementations for different CPU architectures. For example, the 32-bit x86 CRT may have a different implementation than the 64-bit x64 CRT. In addition, some of the functions may have multiple implementations for a given CPU architecture. The most efficient implementation is selected dynamically at run-time depending on the instruction sets supported by the CPU. For example, in the 32-bit x86 CRT, some functions have both an x87 implementation and an SSE2 implementation. When running on a CPU that supports SSE2, the faster SSE2 implementation is used. When running on a CPU that doesn't support SSE2, the slower x87 implementation is used. Because different implementations of the math library functions may use different CPU instructions and different algorithms to produce their results, the functions may produce different results across CPUs. In most cases, the results are within +/-1 ULP of the correctly rounded result, but the actual results may vary across CPUs.

Newer versions of the UCRT might improve the precision and accuracy of the floating-point math library functions. Since the UCRT is part of the Windows operating system, you might get different results for these functions on different operating system versions or between debug and release builds. Although it is not recommended, you can statically link to the UCRT to guarantee consistent results if you need these functions will produce identical results everywhere.

Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual C++ supported the **`long double`** type as an 80-bit precision floating-point data type. In later versions of Visual C++, the **`long double`** data type is a 64-bit precision floating-point data type identical to the **`double`** type. The compiler treats **`long double`** and **`double`** as distinct types, but the **`long double`** functions are identical to their **`double`** counterparts. The CRT provides **`long double`** versions of the math functions for ISO C99 source code compatibility, but note that the binary representation may differ from other compilers.

Expand Down Expand Up @@ -79,7 +81,7 @@ Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual C++ supported t
| [`imaxabs`](./reference/imaxabs.md) | Computes the absolute value of an integer type |
| [`imaxdiv`](./reference/imaxdiv.md) | Computes the quotient and the remainder of two integer values |
| [`isfinite`, `_finite`, `_finitef`](./reference/finite-finitef.md) | Determines whether a value is finite |
| [`isgreater`, `isgreaterequal`, `isless`, `islessequal`, `islessgreater`, `isunordered`](./reference/floating-point-ordering.md) | Compare the order of two floating point values |
| [`isgreater`, `isgreaterequal`, `isless`, `islessequal`, `islessgreater`, `isunordered`](./reference/floating-point-ordering.md) | Compare the order of two floating-point values |
| [`isinf`](./reference/isinf.md) | Determines whether a floating-point value is infinite |
| [`isnan`, `_isnan`, `_isnanf`](./reference/isnan-isnan-isnanf.md) | Tests a floating-point value for NaN |
| [`isnormal`](./reference/isnormal.md) | Tests whether a floating-point value is both finite and not subnormal |
Expand Down
12 changes: 5 additions & 7 deletions docs/cpp/import-export-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Use import and export declarations to access and to publish types a
---
# `module`, `import`, `export`

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

## `module`

Expand Down Expand Up @@ -43,8 +43,6 @@ namespace ModuleA_NS
Non-exported names aren't visible to code that imports the module:

```cpp
//MyProgram.cpp

import ModuleA;

int main() {
Expand All @@ -64,9 +62,8 @@ Use an **`import`** declaration to make a module's names visible in your program
module ModuleA;

#include "custom-lib.h"
import std.core;
import std.regex;
import ModuleB;
import std;
import myModule;

// begin declarations here:
template <class T>
Expand Down Expand Up @@ -114,4 +111,5 @@ import // Always an identifier, never a keyword

## See Also

[Overview of modules in C++](modules-cpp.md)
[Overview of modules in C++](modules-cpp.md)\
[Import the C++ standard library using modules](tutorial-import-stl-named-module.md)
14 changes: 8 additions & 6 deletions docs/cpp/modules-cpp.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Overview of modules in C++"
description: Modules in C++20 provide a modern alternative to header files.
ms.date: 02/11/2025
ms.date: 04/17/2025
helpviewer_keywords: ["modules [C++]", "modules [C++], overview"]
---
# Overview of modules in C++
Expand Down Expand Up @@ -48,8 +48,8 @@ The file *`MyProgram.cpp`* uses **`import`** to access the name exported by `Exa

```cpp
// MyProgram.cpp
import std;
import Example;
import std.core;

using namespace std;

Expand Down Expand Up @@ -156,7 +156,7 @@ You can include header files in a module source file by putting an `#include` di
#include "customlib.h"
#include "anotherlib.h"

import std.core;
import std;
import MyModuleB;

//... rest of file
Expand All @@ -166,9 +166,10 @@ You can use a traditional header file to control which modules are imported:

```cpp
// MyProgram.h
import std.core;
#ifdef DEBUG_LOGGING
import std.filesystem;
#ifdef C_RUNTIME_GLOBALS
import std.compat;
#else
import std;
#endif
```

Expand All @@ -183,6 +184,7 @@ import "myheader.h";

## See also

[Import the C++ standard library using modules](tutorial-import-stl-named-module.md)\
[`module`, `import`, `export`](import-export-module.md)\
[Named modules tutorial](tutorial-named-modules-cpp.md)\
[Compare header units, modules, and precompiled headers](../build/compare-inclusion-methods.md)