Skip to content

Commit 6d4f636

Browse files
TylerMSFTTylerMSFT
authored andcommitted
various github issue fixe
1 parent cdc82bf commit 6d4f636

8 files changed

Lines changed: 91 additions & 69 deletions

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: 17 additions & 11 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
@@ -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/linux/cmake-linux-configure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ When you do a build:
9696

9797
## Choose a Linux target
9898

99-
When you open a CMake project folder, Visual Studio parses the *CMakeLists.txt* file and specifies a Windows target of **x86-Debug**. To target a remote Linux system, you'll change the project settings to **Linux-Debug** or **Linux-Release**.
99+
When you open a CMake project folder, Visual Studio parses the *CMakeLists.txt* file and specifies a Windows target of **x86-Debug**. To target a remote Linux system, you'll change the project settings, based on your Linux compiler, to something like **Linux-Debug** or **Linux-Release**.
100100

101101
If you specify a remote Linux target, your source is copied to the remote system.
102102

docs/linux/linux-asan-configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Configure Linux projects to use Address Sanitizer"
33
description: "Describes how to configure C++ Linux projects in Visual Studio to use Address Sanitizer."
4-
ms.date: "06/07/2019"
4+
ms.date: "09/25/2020"
55
---
66
# Configure Linux projects to use Address Sanitizer
77

@@ -27,7 +27,7 @@ You can also view the full ASan output (including where the corrupted memory was
2727
## Enable ASan for MSBuild-based Linux projects
2828

2929
> [!NOTE]
30-
> Starting in Visual Studio 2019 version 16.4, AddressSanitizer for Linux projects is enabled via **Configuration Properties** > **C/C++** > **Enable Address Sanitizer**.
30+
> Starting in Visual Studio 2019 version 16.4, AddressSanitizer for Linux projects is enabled via **Project properties** > **Configuration Properties** > **C/C++** > **Enable Address Sanitizer**.
3131
3232
To enable ASan for MSBuild-based Linux projects, right-click on the project in **Solution Explorer** and select **Properties**. Next, navigate to **Configuration Properties** > **C/C++** > **Sanitizers**. ASan is enabled via compiler and linker flags, and requires your project to be recompiled to work.
3333

@@ -45,7 +45,7 @@ Make sure you have a Linux configuration (for example, **Linux-Debug**) selected
4545

4646
![Screenshot of the left pane with Linux Debug listed as one of the Configuration options.](media/linux-debug-configuration.png)
4747

48-
The ASan options are under **General**. Enter the ASan runtime flags in the format "flag=value", separated by semicolons.
48+
The ASan options are under **General**. Enter the ASan runtime flags in the format "flag=value", separated by spaces. The UI incorrectly suggests using semi-colons. Use spaces or colons, instead.
4949

5050
![Screenshot of the Enable Address Sanitizer option showing some Address Sanitizer run time flags.](media/cmake-settings-asan-options.png)
5151

1.12 KB
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BEGIN_MESSAGE_MAP(CMyView, CFormView)
1+
BEGIN_MESSAGE_MAP(CMyView, CView)

docs/mfc/derived-message-maps.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
---
22
title: "Derived Message Maps"
3-
ms.date: "11/19/2018"
3+
description: "Describes MFC message handling."
4+
ms.date: "09/23/2020"
45
helpviewer_keywords: ["message handling [MFC], derived message handlers", "messages, routing", "message maps [MFC], derived", "derived message maps"]
56
ms.assetid: 21829556-6e64-40c3-8279-fed85d99de77
67
---
78
# Derived Message Maps
89

9-
During message handling, checking a class's own message map is not the end of the message-map story. What happens if class `CMyView` (derived from `CView`) has no matching entry for a message
10+
During message handling, checking a class's own message map is not the end of the message-map story. What happens if class `CMyView` (derived from `CView`) has no matching entry for a message?
1011

11-
Keep in mind that `CView`, the base class of `CMyView`, is derived in turn from `CWnd`. Thus `CMyView` *is* a `CView` and *is* a `CWnd`. Each of those classes has its own message map. The figure "A View Hierarchy" below shows the hierarchical relationship of the classes, but keep in mind that a `CMyView` object is a single object that has the characteristics of all three classes.
12+
Keep in mind that `CView`, the base class of `CMyView`, is derived in turn from `CWnd`. Thus `CMyView` *is* a `CView` and *is* a `CWnd`. Each of those classes has its own message map. The figure below shows the hierarchical relationship of the classes, but keep in mind that a `CMyView` object is a single object that has the characteristics of all three classes.
1213

1314
![Hierarchy of a view](../mfc/media/vc38621.gif "Hierarchy of a view") <br/>
1415
A View Hierarchy
1516

16-
So if a message can't be matched in class `CMyView`'s message map, the framework also searches the message map of its immediate base class. The `BEGIN_MESSAGE_MAP` macro at the start of the message map specifies two class names as its arguments:
17+
If a message can't be matched in class `CMyView`'s message map, the framework also searches the message map of its immediate base class. The `BEGIN_MESSAGE_MAP` macro at the start of the message map specifies two class names as its arguments:
1718

1819
[!code-cpp[NVC_MFCMessageHandling#2](codesnippet/cpp/derived-message-maps_1.cpp)]
1920

20-
The first argument names the class to which the message map belongs. The second argument provides a connection with the immediate base class`CView` here — so the framework can search its message map, too.
21+
The first argument names the class to which the message map belongs. The second argument provides a connection with the immediate base class, in this case `CView`, so that the framework can search its message map, too.
2122

2223
The message handlers provided in a base class are thus inherited by the derived class. This is very similar to normal virtual member functions without needing to make all handler member functions virtual.
2324

0 commit comments

Comments
 (0)