Skip to content

Commit 0123840

Browse files
authored
Merge branch 'master' into cr-new-error
2 parents 0d60759 + 6301502 commit 0123840

285 files changed

Lines changed: 5968 additions & 5238 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/atl/reference/cautovectorptr-class.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class CAutoVectorPtr
8282
|[CAutoVectorPtr::m_p](#m_p)|The pointer data member variable.|
8383

8484
## Remarks
85-
This class provides methods for creating and managing a smart pointer, which will help protect against memory leaks by automatically freeing resources when it falls out of scope. `CAutoVectorPtr` is similar to `CAutoPtr`, the only difference being that `CAutoVectorPtr` uses [vector new[]](../../standard-library/new-operators.md#operator_new_arr) and [vector delete[]](../../standard-library/new-operators.md#operator_delete_arr) to allocate and free memory instead of the C++ **new** and **delete** operators. See [CAutoVectorPtrElementTraits](../../atl/reference/cautovectorptrelementtraits-class.md) if collection classes of `CAutoVectorPtr` are required.
85+
This class provides methods for creating and managing a smart pointer, which will help protect against memory leaks by automatically freeing resources when it falls out of scope. `CAutoVectorPtr` is similar to `CAutoPtr`, the only difference being that `CAutoVectorPtr` uses [vector new[]](../../standard-library/new-operators.md#op_new_arr) and [vector delete[]](../../standard-library/new-operators.md#op_delete_arr) to allocate and free memory instead of the C++ **new** and **delete** operators. See [CAutoVectorPtrElementTraits](../../atl/reference/cautovectorptrelementtraits-class.md) if collection classes of `CAutoVectorPtr` are required.
8686

8787

8888
See [CAutoPtr](../../atl/reference/cautoptr-class.md) for an example of using a smart pointer class.

‎docs/build/reference/zc-throwingnew-assume-operator-new-throws.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ When the `/Zc:throwingNew` option is specified, the compiler optimizes calls to
4848

4949
## Remarks
5050

51-
Since ISO C++98, the standard has specified that the default [operator new](../../standard-library/new-operators.md#operator_new) throws `std::bad_alloc` when memory allocation fails. Versions of Visual C++ up to Visual Studio 6.0 returned a null pointer on an allocation failure. Beginning in Visual Studio 2002, `operator new` conforms to the standard and throws on failure. To support code that uses the older allocation style, Visual Studio provides a linkable implementation of `operator new` in *nothrownew.obj* that returns a null pointer on failure. By default, the compiler also generates defensive null checks to prevent these older-style allocators from causing an immediate crash on failure. The `/Zc:throwingNew` option tells the compiler to leave out these null checks, on the assumption that all linked memory allocators conform to the standard. This does not apply to explicit non-throwing `operator new` overloads, which are declared by using an additional parameter of type `std::nothrow_t` and have an explicit `noexcept` specification.
51+
Since ISO C++98, the standard has specified that the default [operator new](../../standard-library/new-operators.md#op_new) throws `std::bad_alloc` when memory allocation fails. Versions of Visual C++ up to Visual Studio 6.0 returned a null pointer on an allocation failure. Beginning in Visual Studio 2002, `operator new` conforms to the standard and throws on failure. To support code that uses the older allocation style, Visual Studio provides a linkable implementation of `operator new` in *nothrownew.obj* that returns a null pointer on failure. By default, the compiler also generates defensive null checks to prevent these older-style allocators from causing an immediate crash on failure. The `/Zc:throwingNew` option tells the compiler to leave out these null checks, on the assumption that all linked memory allocators conform to the standard. This does not apply to explicit non-throwing `operator new` overloads, which are declared by using an additional parameter of type `std::nothrow_t` and have an explicit `noexcept` specification.
5252

5353
Conceptually, to create an object on the free store, the compiler generates code to allocate its memory and then to invoke its constructor to initialize the memory. Because the Visual C++ compiler normally cannot tell if this code will be linked to a non-conforming, non-throwing allocator, by default it also generates a null check before calling the constructor. This prevents a null pointer dereference in the constructor call if a non-throwing allocation fails. In most cases, these checks are unnecessary, because the default `operator new` allocators throw instead of returning null pointers. The checks also have unfortunate side effects. They bloat the code size, they flood the branch predictor, and they inhibit other useful compiler optimizations such as devirtualization or const propagation out of the initialized object. The checks exist only to support code that links to *nothrownew.obj* or has custom non-conforming `operator new` implementations. If you do not use non-conforming `operator new`, we recommend you use `/Zc:throwingNew` to optimize your code.
5454

‎docs/c-runtime-library/reference/strstr-wcsstr-mbsstr-mbsstr-l.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,4 @@ lazy found at position 36
219219
[strpbrk, wcspbrk, _mbspbrk, _mbspbrk_l](../../c-runtime-library/reference/strpbrk-wcspbrk-mbspbrk-mbspbrk-l.md)
220220
[strrchr, wcsrchr, _mbsrchr, _mbsrchr_l](../../c-runtime-library/reference/strrchr-wcsrchr-mbsrchr-mbsrchr-l.md)
221221
[strspn, wcsspn, _mbsspn, _mbsspn_l](../../c-runtime-library/reference/strspn-wcsspn-mbsspn-mbsspn-l.md)
222-
[basic_string::find](../../standard-library/basic-string-class.md#basic_string__find)
222+
[basic_string::find](../../standard-library/basic-string-class.md#find)

‎docs/cpp-conformance-improvements-2017.md‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,16 +278,6 @@ static_assert(test2, "PASS2");
278278
### Classes declared in anonymous namespaces
279279
According to the C++ standard, a class declared inside an anonymous namespace has internal linkage, and therefore cannot be exported. In Visual Studio 2015 and earlier, this rule was not enforced. In Visual Studio 2017 the rule is partially enforced. The following example raises this error in Visual Studio 2017: "error C2201: 'const `anonymous namespace'::S1::`vftable'': must have external linkage in order to be exported/imported."
280280

281-
```cpp
282-
namespace
283-
{
284-
struct __declspec(dllexport) S1 { virtual void f() {} }; //C2201
285-
}
286-
```
287-
288-
### Classes declared in anonymous namespaces
289-
According to the C++ standard, a class declared inside an anonymous namespace has internal linkage, and therefore cannot be exported. In Visual Studio 2015 and earlier, this rule was not enforced. In Visual Studio 2017 the rule is partially enforced. The following example raises this error in Visual Studio 2017: "error C2201: 'const `anonymous namespace'::S1::`vftable'': must have external linkage in order to be exported/imported."
290-
291281
```cpp
292282
struct __declspec(dllexport) S1 { virtual void f() {} }; //C2201
293283
```

‎docs/cpp/nonstandard-behavior.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void g() throw(); // parsed and used
9292
For more information on exception specifications, see [Exception Specifications](../cpp/exception-specifications-throw-cpp.md).
9393

9494
## char_traits::eof()
95-
The C++ standard states that [char_traits::eof](../standard-library/char-traits-struct.md#char_traits__eof) must not correspond to a valid `char_type` value. The Visual C++ compiler enforces this constraint for type `char`, but not for type `wchar_t`. This does not comply with the requirement in Table 62 in section 12.1.1 of the C++ ISO specification. The example below demonstrates this.
95+
The C++ standard states that [char_traits::eof](../standard-library/char-traits-struct.md#eof) must not correspond to a valid `char_type` value. The Visual C++ compiler enforces this constraint for type `char`, but not for type `wchar_t`. This does not comply with the requirement in Table 62 in section 12.1.1 of the C++ ISO specification. The example below demonstrates this.
9696

9797
```cpp
9898
#include <iostream>

‎docs/cppcx/strings-c-cx.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Text in the [!INCLUDE[wrt](../cppcx/includes/wrt-md.md)] is represented in C++/C
4040
## String conversions
4141
A `Platform::String` can contain only `char16` characters, or the `NULL` character. If your application has to work with 8-bit characters, use the [String::Data](../cppcx/platform-string-class.md#data) to extract the text as a `const wchar_t*`. You can then use the appropriate Windows functions or Standard Library functions to operate on the data and convert it back to a `wchar_t*` or [wstring](../standard-library/basic-string-class.md), which you can use to construct a new `Platform::String`.
4242

43-
The following code fragment shows how to convert a `String^` variable to and from a `wstring` variable. For more information about the string manipulation that's used in this example, see [basic_string::replace](../standard-library/basic-string-class.md#basic_string__replace).
43+
The following code fragment shows how to convert a `String^` variable to and from a `wstring` variable. For more information about the string manipulation that's used in this example, see [basic_string::replace](../standard-library/basic-string-class.md#replace).
4444

4545
[!code-cpp[cx_strings#04](../cppcx/codesnippet/CPP/cppcx_strings/class1.cpp#04)]
4646

‎docs/error-messages/compiler-errors-2/compiler-error-c2815.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ translation.priority.ht:
3737
# Compiler Error C2815
3838
'operator delete' : first formal parameter must be 'void *', but 'param' was used
3939

40-
Any user-defined [operator delete](../../standard-library/new-operators.md#operator_delete) function must take a first formal parameter of type `void *`.
40+
Any user-defined [operator delete](../../standard-library/new-operators.md#op_delete) function must take a first formal parameter of type `void *`.
4141

4242
The following sample generates C2815:
4343

‎docs/error-messages/compiler-errors-2/compiler-error-c2817.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ translation.priority.ht:
3737
# Compiler Error C2817
3838
return type for 'operator delete' must be 'void'
3939

40-
An overloaded [operator delete](../../standard-library/new-operators.md#operator_delete) function cannot return a value.
40+
An overloaded [operator delete](../../standard-library/new-operators.md#op_delete) function cannot return a value.

‎docs/error-messages/compiler-errors-2/compiler-error-c2821.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ translation.priority.ht:
3737
# Compiler Error C2821
3838
first formal parameter to 'operator new' must be 'unsigned int'
3939

40-
The first formal parameter of the [operator new](../../standard-library/new-operators.md#operator_new) must be an unsigned `int`.
40+
The first formal parameter of the [operator new](../../standard-library/new-operators.md#op_new) must be an unsigned `int`.
4141

4242
## Example
4343
The following sample generates C2821:

‎docs/error-messages/compiler-errors-2/compiler-error-c2830.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ translation.priority.ht:
3737
# Compiler Error C2830
3838
only placement parameters to 'operator new' can have default values
3939

40-
The standard formal parameters for [operator new](../../standard-library/new-operators.md#operator_new) cannot have default values. Only user-defined placement parameters can specify defaults.
40+
The standard formal parameters for [operator new](../../standard-library/new-operators.md#op_new) cannot have default values. Only user-defined placement parameters can specify defaults.

0 commit comments

Comments
 (0)