Skip to content

Commit 94b24fb

Browse files
authored
Merge pull request MicrosoftDocs#5097 from MicrosoftDocs/FromPublicMasterBranch
Confirm merge from FromPublicMasterBranch to main to sync with https://github.com/MicrosoftDocs/cpp-docs (branch main)
2 parents 05db3cd + eff4443 commit 94b24fb

File tree

13 files changed

+151
-23
lines changed

13 files changed

+151
-23
lines changed

docs/build/reference/microsoft-extensions-to-c-and-cpp.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ The C compiler supports the following data declaration and definition features.
205205
// error C2059: syntax error: 'empty declaration'
206206
```
207207
208-
209208
## Intrinsic floating-point functions
210209
211210
Both the x86 C++ compiler and C compiler support inline generation of the `atan`, `atan2`, `cos`, `exp`, `log`, `log10`, `sin`, `sqrt`, and `tan` functions when **`/Oi`** is specified. These intrinsics don't conform to the standard, because they don't set the `errno` variable.

docs/c-runtime-library/reference/atoi-atoi-l-wtoi-wtoi-l.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ These functions convert a character string to an integer value (**`atoi`** and *
5353

5454
The *`str`* argument to **`atoi`** and **`_wtoi`** has the following form:
5555

56-
> [*`whitespace`*] [*`sign`*] [*`digits`*]]
56+
> [*`whitespace`*] [*`sign`*] [*`digits`*]
5757
5858
A *`whitespace`* consists of space or tab characters, which are ignored; *`sign`* is either plus (+) or minus (-); and *`digits`* are one or more digits.
5959

docs/c-runtime-library/reference/atol-atol-l-wtol-wtol-l.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The input string is a sequence of characters that can be interpreted as a numeri
5454

5555
The *`str`* argument to **`atol`** has the following form:
5656

57-
> [*`whitespace`*] [*`sign`*] [*`digits`*]]
57+
> [*`whitespace`*] [*`sign`*] [*`digits`*]
5858
5959
A *`whitespace`* consists of space or tab characters, which are ignored; *`sign`* is either plus (`+`) or minus (`-`); and *`digits`* are one or more digits.
6060

docs/c-runtime-library/reference/fsopen-wfsopen.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ The argument *`shflag`* is a constant expression consisting of one of the follow
9191
| `_SH_DENYRW` | Denies read and write access to the file. |
9292
| `_SH_DENYWR` | Denies write access to the file. |
9393

94-
9594
By default, this function's global state is scoped to the application. To change this behavior, see [Global state in the CRT](../global-state.md).
9695

9796
### Generic-text routine mappings

docs/code-quality/c26460.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ struct MyStruct
2424
void MemberFn2();
2525
};
2626

27-
2827
void Function1_Helper(const MyStruct&);
2928
void Function1(MyStruct& myStruct) // C26460, see comments below.
3029
{

docs/cpp/codesnippet/CPP/smart-pointers-modern-cpp_1.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ void UseRawPointer()
99
delete pSong;
1010
}
1111

12-
1312
void UseSmartPointer()
1413
{
1514
// Declare a smart pointer on stack and pass it the raw pointer.

docs/cpp/noreturn.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,49 @@ ms.assetid: 9c6517e5-22d7-4051-9974-3d2200ae4d1d
1010

1111
**Microsoft Specific**
1212

13-
This **`__declspec`** attribute tells the compiler that a function does not return. As a consequence, the compiler knows that the code following a call to a **`__declspec(noreturn)`** function is unreachable.
13+
The **`__declspec`** attribute tells the compiler that a function does not return. The compiler then knows that the code following a call to a **`__declspec(noreturn)`** function is unreachable.
1414

15-
If the compiler finds a function with a control path that does not return a value, it generates a warning (C4715) or error message (C2202). If the control path cannot be reached due to a function that never returns, you can use **`__declspec(noreturn)`** to prevent this warning or error.
15+
If the compiler finds a function with a control path that does not return a value, it generates a warning (C4715) or error message (C2202). If the control path cannot be reached due to a function that never returns, use **`__declspec(noreturn)`** to prevent this warning or error.
1616

1717
> [!NOTE]
1818
> Adding **`__declspec(noreturn)`** to a function that is expected to return can result in undefined behavior.
1919
2020
## Example
2121

22-
In the following sample,the **`else`** clause does not contain a return statement. Declaring `fatal` as **`__declspec(noreturn)`** avoids an error or warning message.
22+
In the following example, when the argument for `isZeroOrPositive` is negative, `fatal` is called. There isn't a return statement in that control path, which results in warning C4715 that not all control paths return a value. Declaring `fatal` as **`__declspec(noreturn)`** mitigates that warning, which is desirable because there is no point in it since `fatal()` terminates the program.
2323

2424
```cpp
2525
// noreturn2.cpp
26-
__declspec(noreturn) extern void fatal () {}
27-
28-
int main() {
29-
if(1)
30-
return 1;
31-
else if(0)
32-
return 0;
33-
else
34-
fatal();
26+
#include <exception>
27+
28+
__declspec(noreturn) void fatal()
29+
{
30+
std::terminate();
31+
}
32+
33+
int isZeroOrPositive(int val)
34+
{
35+
if (val == 0)
36+
{
37+
return 0;
38+
}
39+
else if (val > 0)
40+
{
41+
return 1;
42+
}
43+
// this function terminates if val is negative
44+
fatal();
45+
}
46+
47+
int main()
48+
{
49+
isZeroOrPositive(123);
3550
}
3651
```
3752
3853
**END Microsoft Specific**
3954
4055
## See also
4156
42-
[__declspec](../cpp/declspec.md)<br/>
57+
[__declspec](../cpp/declspec.md)\
4358
[Keywords](../cpp/keywords-cpp.md)

docs/cpp/raw-pointers.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ void func_B(MyClass mc)
8181
mc.print(); // "Erika, 21"
8282
}
8383

84-
8584
int main()
8685
{
8786
// Use the * operator to declare a pointer type

docs/error-messages/compiler-warnings/c4834.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ This sample generates C4834, and shows four ways to fix it:
4040
[[nodiscard]]
4141
int square_of(int i) { return i * i; }
4242

43-
4443
int main()
4544
{
4645
square_of(42); // warning C4834: discarding return value of function with 'nodiscard' attribute

docs/overview/cpp-conformance-improvements.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,111 @@ namespace Gui
119119
}
120120
```
121121

122+
## <a name="improvements_178"></a> Conformance improvements in Visual Studio 2022 version 17.8
123+
124+
Visual Studio 2022 version 17.8 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
125+
126+
### /FU issues an error
127+
128+
The C compiler used to accept the `/FU` option, even though it hasn't support managed compilation for some time. It now issues an error. Projects that pass this option need to restrict it to C++/CLI projects only.
129+
130+
### C++ Standard Library
131+
132+
The C++23 named modules `std` and `std.compat` are now available when compiling with `/std:c++20`.
133+
134+
For a broader summary of changes made to the C++ Standard Library, see [STL Changelog VS 2022 17.8](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-178-preview-3).
135+
136+
## <a name="improvements_177"></a> Conformance improvements in Visual Studio 2022 version 17.7
137+
138+
Visual Studio 2022 version 17.7 contains the following highlighted conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
139+
140+
### Added `/std:clatest` to the C compiler
141+
142+
This switch behaves like the `/std:c++latest` switch for the C++ compiler. The switch enables all currently implemented compiler and standard library features proposed for the next draft C standard, as well as some in-progress and experimental features.
143+
144+
### C++ Standard Library
145+
146+
The `<print>` library is now supported. See [P2093R14 Formatted output](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2093r14.html).
147+
148+
Implemented `views::cartesian_product`.
149+
150+
For a broader summary of changes made to the Standard Template Library, see [STL Changelog VS 2022 17.7](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-177).
151+
152+
### `using` conformance
153+
154+
Previously, the `using` directive could cause names from used namespaces to remain visible when they shouldn't. This could cause unqualified name lookup to find a name in a namespace even when there's no `using` directive active.
155+
156+
Here are some examples of the new and old behavior.\
157+
References in the following comments to "(1)" mean the call to `f<K>(t)` in namespace `A`:
158+
159+
```cpp
160+
namespace A
161+
{
162+
template<typename K, typename T>
163+
auto f2(T t)
164+
{
165+
return f<K>(t); // (1) Unqualified lookup should not find anything
166+
}
167+
}
168+
169+
namespace B
170+
{
171+
template<typename K, typename T>
172+
auto f(T t) noexcept
173+
{ // Previous behavior: This function was erroneously found during unqualified lookup at (1)
174+
return A::f2<K>(t);
175+
}
176+
}
177+
178+
namespace C
179+
{
180+
template<typename T>
181+
struct S {};
182+
183+
template<typename, typename U>
184+
U&& f(U&&) noexcept; // New behavior: ADL at (1) correctly finds this function
185+
}
186+
187+
namespace D
188+
{
189+
using namespace B;
190+
191+
void h()
192+
{
193+
D::f<void>(C::S<int>());
194+
}
195+
}
196+
```
197+
198+
The same underlying issue can cause code that previously compiled to now be rejected:
199+
200+
```cpp
201+
#include <memory>
202+
namespace Addin {}
203+
namespace Gui
204+
{
205+
using namespace Addin;
206+
}
207+
208+
namespace Addin
209+
{
210+
using namespace std;
211+
}
212+
213+
// This previously compiled, but now emits error C2065 for undeclared name 'allocator'.
214+
// This should be declared as 'std::allocator<T*>' because the using directive nominating
215+
// 'std' is not active at this point.
216+
template <class T, class U = allocator<T*>>
217+
class resource_list
218+
{
219+
};
220+
221+
namespace Gui
222+
{
223+
typedef resource_list<int> intlist;
224+
}
225+
```
226+
122227
## <a name="improvements_176"></a> Conformance improvements in Visual Studio 2022 version 17.6
123228

124229
Visual Studio 2022 version 17.6 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.

0 commit comments

Comments
 (0)