Skip to content

Commit 9489397

Browse files
authored
Merge pull request #3168 from MicrosoftDocs/master
9/28/2020 AM Publish
2 parents d9c94dc + b0aa7a3 commit 9489397

File tree

41 files changed

+328
-336
lines changed

Some content is hidden

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

41 files changed

+328
-336
lines changed

.openpublishing.redirection.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8607,42 +8607,42 @@
86078607
},
86088608
{
86098609
"source_path": "docs/windows/creating-a-new-toolbar-button.md",
8610-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8610+
"redirect_url": "/cpp/windows/toolbar-editor",
86118611
"redirect_document_id": false
86128612
},
86138613
{
86148614
"source_path": "docs/windows/moving-a-toolbar-button.md",
8615-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8615+
"redirect_url": "/cpp/windows/toolbar-editor",
86168616
"redirect_document_id": false
86178617
},
86188618
{
86198619
"source_path": "docs/windows/copying-buttons-from-a-toolbar.md",
8620-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8620+
"redirect_url": "/cpp/windows/toolbar-editor",
86218621
"redirect_document_id": false
86228622
},
86238623
{
86248624
"source_path": "docs/windows/deleting-a-toolbar-button.md",
8625-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8625+
"redirect_url": "/cpp/windows/toolbar-editor",
86268626
"redirect_document_id": false
86278627
},
86288628
{
86298629
"source_path": "docs/windows/inserting-a-space-between-buttons-on-a-toolbar.md",
8630-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8630+
"redirect_url": "/cpp/windows/toolbar-editor",
86318631
"redirect_document_id": false
86328632
},
86338633
{
86348634
"source_path": "docs/windows/removing-space-between-buttons-on-a-toolbar.md",
8635-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8635+
"redirect_url": "/cpp/windows/toolbar-editor",
86368636
"redirect_document_id": false
86378637
},
86388638
{
86398639
"source_path": "docs/windows/changing-the-properties-of-a-toolbar-button.md",
8640-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8640+
"redirect_url": "/cpp/windows/toolbar-editor",
86418641
"redirect_document_id": false
86428642
},
86438643
{
86448644
"source_path": "docs/windows/toolbar-button-properties.md",
8645-
"redirect_url": "/cpp/windows/creating-moving-and-editing-toolbar-buttons",
8645+
"redirect_url": "/cpp/windows/toolbar-editor",
86468646
"redirect_document_id": false
86478647
},
86488648
{
Loading

docs/c-runtime-library/reference/aligned-msize.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Returns the size of a memory block allocated in the heap.
1616
## Syntax
1717

1818
```C
19-
size_t _msize(
19+
size_t _aligned_msize(
2020
void *memblock,
2121
size_t alignment,
2222
size_t offset
@@ -44,15 +44,15 @@ The **_aligned_msize** function returns the size, in bytes, of the memory block
4444

4545
When the application is linked with a debug version of the C run-time libraries, **_aligned_msize** resolves to [_aligned_msize_dbg](aligned-msize-dbg.md). For more information about how the heap is managed during the debugging process, see [The CRT Debug Heap](/visualstudio/debugger/crt-debug-heap-details).
4646

47-
This function validates its parameter. If *memblock* is a null pointer or *alignment* is not a power of 2, **_msize** invokes an invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If the error is handled, the function sets **errno** to **EINVAL** and returns -1.
47+
This function validates its parameter. If *memblock* is a null pointer or *alignment* is not a power of 2, **_aligned_msize** invokes an invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If the error is handled, the function sets **errno** to **EINVAL** and returns -1.
4848

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

5151
## Requirements
5252

5353
|Routine|Required header|
5454
|-------------|---------------------|
55-
|**_msize**|\<malloc.h>|
55+
|**_aligned_msize**|\<malloc.h>|
5656

5757
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
5858

docs/c-runtime-library/reference/round-roundf-roundl.md

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "round, roundf, roundl"
3-
description: "API reference for round, roundf, and roundl; which round a floating-point value to the nearest integer."
4-
ms.date: "9/1/2020"
3+
description: "API reference for round, roundf, and roundl; which round a floating-point value to the nearest integer value."
4+
ms.date: "09/25/2020"
55
api_name: ["round", "roundl", "roundf", "_o_round", "_o_roundf", "_o_roundl"]
66
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-math-l1-1-0.dll", "api-ms-win-crt-private-l1-1-0.dll"]
77
api_type: ["DLLExport"]
@@ -12,7 +12,7 @@ ms.assetid: 6be90877-193c-4b80-a32b-c3eca33f9c6f
1212
---
1313
# round, roundf, roundl
1414

15-
Rounds a floating-point value to the nearest integer.
15+
Rounds a floating-point value to the nearest integer value.
1616

1717
## Syntax
1818

@@ -68,46 +68,60 @@ For additional compatibility information, see [Compatibility](../../c-runtime-li
6868
## Example
6969
7070
```C
71-
// crt_round.c
72-
// Build with: cl /W3 /Tc crt_round.c
73-
// This example displays the rounded results of
74-
// the floating-point values 2.499999, -2.499999,
75-
// 2.8, -2.8, 2.5 and -2.5.
71+
// Build with: cl /W3 /Tc
72+
// This example displays the rounded
73+
// results of floating-point values
7674
7775
#include <math.h>
7876
#include <stdio.h>
7977
80-
int main( void )
78+
int main()
8179
{
82-
double x = 2.499999;
83-
float y = 2.8f;
84-
long double z = 2.5;
85-
86-
printf("round(%f) is %.0f\n", x, round(x));
87-
printf("round(%f) is %.0f\n", -x, round(-x));
88-
printf("roundf(%f) is %.0f\n", y, roundf(y));
89-
printf("roundf(%f) is %.0f\n", -y, roundf(-y));
90-
printf("roundl(%Lf) is %.0Lf\n", z, roundl(z));
91-
printf("roundl(%Lf) is %.0Lf\n", -z, roundl(-z));
80+
printf("===== Round a float\n\n");
81+
float floatValue = 2.4999999f; // float stores a value close to, but not exactly equal to, the initializer below. floatValue will contain 2.5 because it is the closest single precision value
82+
printf("roundf(%.1000g) is %.1000g\n", floatValue, roundf(floatValue));
83+
printf("roundf(%.1000g) is %.1000g\n", -floatValue, roundf(-floatValue));
84+
85+
// double stores a value close to, but not exactly equal to, the initializer below. The closest double value is just slightly larger.
86+
double doubleValue = 2.4999999;
87+
printf("\n===== Round a double\n\n");
88+
printf("round(%.1000g) is %.1000g\n", doubleValue, round(doubleValue));
89+
printf("round(%.1000g) is %.1000g\n", -doubleValue, round(-doubleValue));
90+
91+
// long double stores a value close to, but not exactly equal to, the initializer below. The closest long double value is just slightly larger.
92+
long double longDoubleValue = 2.4999999L;
93+
printf("\n===== Round a long double\n\n");
94+
printf("roundl(%.1000g) is %.1000g\n", longDoubleValue, roundl(longDoubleValue));
95+
printf("roundl(%.1000g) is %.1000g\n", -longDoubleValue, roundl(-longDoubleValue));
96+
97+
return 0;
9298
}
9399
```
94100

95101
```Output
96-
round(2.499999) is 2
97-
round(-2.499999) is -2
98-
roundf(2.800000) is 3
99-
roundf(-2.800000) is -3
100-
roundl(2.500000) is 3
101-
roundl(-2.500000) is -3
102+
===== Round a float
103+
104+
roundf(2.5) is 3
105+
roundf(-2.5) is -3
106+
107+
===== Round a double
108+
109+
round(2.499999900000000163657887242152355611324310302734375) is 2
110+
round(-2.499999900000000163657887242152355611324310302734375) is -2
111+
112+
===== Round a long double
113+
114+
roundl(2.499999900000000163657887242152355611324310302734375) is 2
115+
roundl(-2.499999900000000163657887242152355611324310302734375) is -2
102116
```
103117
104118
## See also
105119
106-
[Floating-Point Support](../../c-runtime-library/floating-point-support.md)<br/>
107-
[ceil, ceilf, ceill](ceil-ceilf-ceill.md)<br/>
108-
[floor, floorf, floorl](floor-floorf-floorl.md)<br/>
109-
[fmod, fmodf](fmod-fmodf.md)<br/>
110-
[lrint, lrintf, lrintl, llrint, llrintf, llrintl](lrint-lrintf-lrintl-llrint-llrintf-llrintl.md)<br/>
111-
[lround, lroundf, lroundl, llround, llroundf, llroundl](lround-lroundf-lroundl-llround-llroundf-llroundl.md)<br/>
112-
[nearbyint, nearbyintf, nearbyintl](nearbyint-nearbyintf-nearbyintl1.md)<br/>
113-
[rint, rintf, rintl](rint-rintf-rintl.md)<br/>
120+
[Floating-Point Support](../../c-runtime-library/floating-point-support.md)\
121+
[ceil, ceilf, ceill](ceil-ceilf-ceill.md)\
122+
[floor, floorf, floorl](floor-floorf-floorl.md)\
123+
[fmod, fmodf](fmod-fmodf.md)\
124+
[lrint, lrintf, lrintl, llrint, llrintf, llrintl](lrint-lrintf-lrintl-llrint-llrintf-llrintl.md)\
125+
[lround, lroundf, lroundl, llround, llroundf, llroundl](lround-lroundf-lroundl-llround-llroundf-llroundl.md)\
126+
[nearbyint, nearbyintf, nearbyintl](nearbyint-nearbyintf-nearbyintl1.md)\
127+
[rint, rintf, rintl](rint-rintf-rintl.md)\

docs/c-runtime-library/reference/strerror-s-strerror-s-wcserror-s-wcserror-s.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "strerror_s, _strerror_s, _wcserror_s, __wcserror_s"
3-
ms.date: "06/09/2020"
3+
description: "Functions with security enhancements to get a system error message or print a user-supplied error message."
4+
ms.date: "09/25/2020"
45
api_name: ["__wcserror_s", "_strerror_s", "_wcserror_s", "strerror_s", "_o__strerror_s", "_o__wcserror_s", "_o_strerror_s"]
56
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-runtime-l1-1-0.dll", "api-ms-win-crt-private-l1-1-0.dll"]
67
api_type: ["DLLExport"]
@@ -36,6 +37,9 @@ errno_t __wcserror_s(
3637
size_t sizeInWords,
3738
const wchar_t *strErrMsg
3839
);
40+
```
41+
42+
```cpp
3943
template <size_t size>
4044
errno_t strerror_s(
4145
char (&buffer)[size],
@@ -60,26 +64,26 @@ errno_t __wcserror_s(
6064

6165
### Parameters
6266

63-
*buffer*<br/>
67+
*buffer*\
6468
Buffer to hold error string.
6569

66-
*sizeInBytes*<br/>
70+
*sizeInBytes*\
6771
The number of bytes in the buffer.
6872

69-
*sizeInWords*<br/>
73+
*sizeInWords*\
7074
The number of words in the buffer.
7175

72-
*errnum*<br/>
76+
*errnum*\
7377
Error number.
7478

75-
*strErrMsg*<br/>
79+
*strErrMsg*\
7680
User-supplied message.
7781

7882
## Return Value
7983

8084
Zero if successful, an error code on failure.
8185

82-
### Error Condtions
86+
### Error conditions
8387

8488
|*buffer*|*sizeInBytes/sizeInWords*|*strErrMsg*|Contents of *buffer*|
8589
|--------------|------------------------|-----------------|--------------------------|
@@ -88,6 +92,8 @@ Zero if successful, an error code on failure.
8892

8993
## Remarks
9094

95+
The **strerror_s** function is thread-safe.
96+
9197
The **strerror_s** function maps *errnum* to an error-message string, returning the string in *buffer*. **_strerror_s** doesn't take the error number; it uses the current value of **errno** to determine the appropriate message. Neither **strerror_s** nor **_strerror_s** actually prints the message: For that, you need to call an output function such as [fprintf](fprintf-fprintf-l-fwprintf-fwprintf-l.md):
9298

9399
```C
@@ -98,7 +104,7 @@ if (( _access( "datafile",2 )) == -1 )
98104
}
99105
```
100106

101-
If *strErrMsg* is **NULL**, **_strerror_s** returns a string in *buffer* containing the system error message for the last library call that produced an error. The error-message string is terminated by the newline character ('\n'). If *strErrMsg* is not equal to **NULL**, then **_strerror_s** returns a string in *buffer* containing (in order) your string message, a colon, a space, the system error message for the last library call producing an error, and a newline character. Your string message can be, at most, 94 characters long.
107+
If *strErrMsg* is **NULL**, **_strerror_s** returns a string in *buffer* that contains the system error message for the last library call that produced an error. The error-message string is terminated by the newline character ('\n'). If *strErrMsg* isn't equal to **NULL**, then **_strerror_s** returns a string in *buffer* that contains (in order) your string message, a colon, a space, the system error message for the last library call that produced an error, and a newline character. Your string message can be, at most, 94 characters long.
102108

103109
These functions truncate the error message if its length exceeds the size of the buffer - 1. The resulting string in *buffer* will always be null-terminated.
104110

@@ -108,7 +114,7 @@ The actual error number for **_strerror_s** is stored in the variable [errno](..
108114

109115
These functions validate their parameters. If buffer is **NULL** or if the size parameter is 0, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md) . If execution is allowed to continue, the functions return **EINVAL** and set **errno** to **EINVAL**.
110116

111-
**_strerror_s**, **_wcserror_s**, and **__wcserror_s** are not part of the ANSI definition but are instead Microsoft extensions to it. Do not use them where portability is desired; for ANSI compatibility, use **strerror_s** instead.
117+
**_strerror_s**, **_wcserror_s**, and **__wcserror_s** aren't part of the ANSI definition but are instead Microsoft extensions to it. Don't use them where portability is desired; for ANSI compatibility, use **strerror_s** instead.
112118

113119
In C++, using these functions is simplified by template overloads; the overloads can infer buffer length automatically, eliminating the need to specify a size argument. For more information, see [Secure Template Overloads](../../c-runtime-library/secure-template-overloads.md).
114120

@@ -137,7 +143,7 @@ See the example for [perror](perror-wperror.md).
137143

138144
## See also
139145

140-
[String Manipulation](../../c-runtime-library/string-manipulation-crt.md)<br/>
141-
[clearerr](clearerr.md)<br/>
142-
[ferror](ferror.md)<br/>
143-
[perror, _wperror](perror-wperror.md)<br/>
146+
[String Manipulation](../../c-runtime-library/string-manipulation-crt.md)\
147+
[clearerr](clearerr.md)\
148+
[ferror](ferror.md)\
149+
[perror, _wperror](perror-wperror.md)

docs/cpp/how-to-create-and-use-ccomptr-and-ccomqiptr-instances.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ In classic Windows programming, libraries are often implemented as COM objects (
1111

1212
When you instantiate a Component Object Model (COM) object, store the interface pointer in a COM smart pointer, which performs the reference counting by using calls to `AddRef` and `Release` in the destructor. If you are using the Active Template Library (ATL) or the Microsoft Foundation Class Library (MFC), then use the `CComPtr` smart pointer. If you are not using ATL or MFC, then use `_com_ptr_t`. Because there is no COM equivalent to `std::unique_ptr`, use these smart pointers for both single-owner and multiple-owner scenarios. Both `CComPtr` and `ComQIPtr` support move operations that have rvalue references.
1313

14-
## Example
14+
## Example: CComPtr
1515

1616
The following example shows how to use `CComPtr` to instantiate a COM object and obtain pointers to its interfaces. Notice that the `CComPtr::CoCreateInstance` member function is used to create the COM object, instead of the Win32 function that has the same name.
1717

1818
[!code-cpp[COM_smart_pointers#01](../cpp/codesnippet/CPP/how-to-create-and-use-ccomptr-and-ccomqiptr-instances_1.cpp)]
1919

2020
`CComPtr` and its relatives are part of the ATL and are defined in \<atlcomcli.h>. `_com_ptr_t` is declared in \<comip.h>. The compiler creates specializations of `_com_ptr_t` when it generates wrapper classes for type libraries.
2121

22-
## Example
22+
## Example: CComQIPt
2323

2424
ATL also provides `CComQIPtr`, which has a simpler syntax for querying a COM object to retrieve an additional interface. However, we recommend `CComPtr` because it does everything that `CComQIPtr` can do and is semantically more consistent with raw COM interface pointers. If you use a `CComPtr` to query for an interface, the new interface pointer is placed in an out parameter. If the call fails, an HRESULT is returned, which is the typical COM pattern. With `CComQIPtr`, the return value is the pointer itself, and if the call fails, the internal HRESULT return value cannot be accessed. The following two lines show how the error handling mechanisms in `CComPtr` and `CComQIPtr` differ.
2525

2626
[!code-cpp[COM_smart_pointers#02](../cpp/codesnippet/CPP/how-to-create-and-use-ccomptr-and-ccomqiptr-instances_2.cpp)]
2727

28-
## Example
28+
## Example: IDispatch
2929

3030
`CComPtr` provides a specialization for IDispatch that enables it to store pointers to COM automation components and invoke the methods on the interface by using late binding. `CComDispatchDriver` is a typedef for `CComQIPtr<IDispatch, &IIDIDispatch>`, which is implicitly convertible to `CComPtr<IDispatch>`. Therefore, when any of these three names appears in code, it is equivalent to `CComPtr<IDispatch>`. The following example shows how to obtain a pointer to the Microsoft Word object model by using a `CComPtr<IDispatch>`.
3131

docs/dotnet/debug-class-cpp-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ When using <xref:System.Diagnostics.Debug> in a Visual C++ application, the beha
1212

1313
The behavior for <xref:System.Diagnostics.Trace> is identical to the behavior for the Debug class, but is dependent on the symbol TRACE being defined. This means that you must `#ifdef` any Trace-related code to prevent debug behavior in a release build.
1414

15-
## Example
15+
## Example: Always executes output statements
1616

1717
### Description
1818

@@ -49,7 +49,7 @@ Hello World.
4949
test
5050
```
5151

52-
## Example
52+
## Example: Use #ifdef and #endif directives
5353

5454
### Description
5555

docs/dotnet/double-thunking-cpp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Similarly, if you export ([dllexport, dllimport](../cpp/dllexport-dllimport.md))
1818

1919
The compiler has been updated to reduce unnecessary double thunking. For example, any function with a managed type in the signature (including return type) will implicitly be marked as `__clrcall`.
2020

21-
## Example
21+
## Example: Double thunking
2222

2323
### Description
2424

@@ -76,7 +76,7 @@ after calling struct S
7676
__thiscall T::~T(void)
7777
```
7878
79-
## Example
79+
## Example: Effect of double thunking
8080
8181
### Description
8282

0 commit comments

Comments
 (0)