Skip to content

Commit 2b18399

Browse files
authored
Merge pull request #2959 from TylerMSFT/twhitney-github2017
github fixes
2 parents 1aff48a + 985eebf commit 2b18399

4 files changed

Lines changed: 27 additions & 25 deletions

File tree

docs/c-runtime-library/reference/getchar-getwchar.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "getchar, getwchar"
3-
ms.date: "4/2/2020"
3+
ms.date: "06/23/2020"
44
api_name: ["getchar", "getwchar", "_o_getchar", "_o_getwchar"]
55
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-stdio-l1-1-0.dll", "api-ms-win-crt-private-l1-1-0.dll"]
66
api_type: ["DLLExport"]
@@ -22,13 +22,15 @@ wint_t getwchar();
2222

2323
## Return Value
2424

25-
Returns the character read. To indicate a read error or end-of-file condition, **getchar** returns **EOF**, and **getwchar** returns **WEOF**. For **getchar**, use **ferror** or **feof** to check for an error or for end of file.
25+
Returns the character read. These functions wait for input and don't return until input is available.
26+
27+
To indicate a read error or end-of-file condition, **getchar** returns **EOF**, and **getwchar** returns **WEOF**. For **getchar**, use **ferror** or **feof** to check for an error or for end of file.
2628

2729
## Remarks
2830

29-
Each routine reads a single character from **stdin** and increments the associated file pointer to point to the next character. **getchar** is the same as [_fgetchar](fgetc-fgetwc.md), but it is implemented as a function and as a macro.
31+
Each routine reads a single character from **stdin** and increments the associated file pointer to point to the next character. **getchar** is the same as [_fgetchar](fgetc-fgetwc.md), but it's implemented as a function and as a macro.
3032

31-
These functions lock the calling thread and are therefore thread-safe. For a non-locking version, see [_getchar_nolock, _getwchar_nolock](getchar-nolock-getwchar-nolock.md).
33+
These functions also lock the calling thread and are thread-safe. For a non-locking version, see [_getchar_nolock, _getwchar_nolock](getchar-nolock-getwchar-nolock.md).
3234

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

@@ -45,7 +47,7 @@ By default, this function's global state is scoped to the application. To change
4547
|**getchar**|\<stdio.h>|
4648
|**getwchar**|\<stdio.h> or \<wchar.h>|
4749

48-
The console is not supported in Universal Windows Platform (UWP) apps. The standard stream handles that are associated with the console, **stdin**, **stdout**, and **stderr**, must be redirected before C run-time functions can use them in UWP apps. For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
50+
The console isn't supported in Universal Windows Platform (UWP) apps. The standard stream handles that are associated with the console, **stdin**, **stdout**, and **stderr**, must be redirected before C run-time functions can use them in UWP apps. For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
4951

5052
## Example
5153

docs/c-runtime-library/reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "sprintf, _sprintf_l, swprintf, _swprintf_l, __swprintf_l"
3-
ms.date: "11/04/2016"
3+
ms.date: "06/23/2020"
44
api_name: ["__swprintf_l", "sprintf", "_sprintf_l", "_swprintf_l", "swprintf"]
55
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ntdll.dll", "ucrtbase.dll", "ntoskrnl.exe"]
66
api_type: ["DLLExport"]
@@ -11,7 +11,7 @@ ms.assetid: f6efe66f-3563-4c74-9455-5411ed939b81
1111
---
1212
# sprintf, _sprintf_l, swprintf, _swprintf_l, __swprintf_l
1313

14-
Write formatted data to a string. More secure versions of some of these functions are available; see [sprintf_s, _sprintf_s_l, swprintf_s, _swprintf_s_l](sprintf-s-sprintf-s-l-swprintf-s-swprintf-s-l.md). The secure versions of **swprintf** and **_swprintf_l** do not take a *count* parameter.
14+
Write formatted data to a string. More secure versions of some of these functions are available; see [sprintf_s, _sprintf_s_l, swprintf_s, _swprintf_s_l](sprintf-s-sprintf-s-l-swprintf-s-swprintf-s-l.md). The secure versions of **swprintf** and **_swprintf_l** take the size of the buffer as a parameter.
1515

1616
## Syntax
1717

@@ -91,9 +91,9 @@ The number of characters written, or -1 if an error occurred. If *buffer* or *fo
9191
The **sprintf** function formats and stores a series of characters and values in *buffer*. Each *argument* (if any) is converted and output according to the corresponding format specification in *format*. The format consists of ordinary characters and has the same form and function as the *format* argument for [printf](printf-printf-l-wprintf-wprintf-l.md). A null character is appended after the last character written. If copying occurs between strings that overlap, the behavior is undefined.
9292

9393
> [!IMPORTANT]
94-
> Using **sprintf**, there is no way to limit the number of characters written, which means that code using **sprintf** is susceptible to buffer overruns. Consider using the related function [_snprintf](snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l.md), which specifies a maximum number of characters to be written to *buffer*, or use [_scprintf](scprintf-scprintf-l-scwprintf-scwprintf-l.md) to determine how large a buffer is required. Also, ensure that *format* is not a user-defined string.
94+
> Using **sprintf**, there is no way to limit the number of characters written, which means that code using **sprintf** is susceptible to buffer overruns. Consider using the related function [_snprintf](snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l.md), which specifies a maximum number of characters to write to *buffer*, or use [_scprintf](scprintf-scprintf-l-scwprintf-scwprintf-l.md) to determine how large a buffer is required. Also, ensure that *format* is not a user-defined string.
9595
96-
**swprintf** is a wide-character version of **sprintf**; the pointer arguments to **swprintf** are wide-character strings. Detection of encoding errors in **swprintf** may differ from that in **sprintf**. **swprintf** and **fwprintf** behave identically except that **swprintf** writes output to a string rather than to a destination of type **FILE**, and **swprintf** requires the *count* parameter to specify the maximum number of characters to be written. The versions of these functions with the **_l** suffix are identical except that they use the locale parameter passed in instead of the current thread locale.
96+
**swprintf** is a wide-character version of **sprintf**; the pointer arguments to **swprintf** are wide-character strings. Detection of encoding errors in **swprintf** may differ from **sprintf**. **swprintf** and **fwprintf** behave identically except **swprintf** writes output to a string rather than to a destination of type **FILE**, and **swprintf** requires the *count* parameter to specify the maximum number of characters to write. The versions of these functions with the **_l** suffix are identical except they use the locale parameter passed in instead of the current thread locale.
9797

9898
**swprintf** conforms to the ISO C Standard, which requires the second parameter, *count*, of type **size_t**. To force the old nonstandard behavior, define **_CRT_NON_CONFORMING_SWPRINTFS**. In a future version, the old behavior may be removed, so code should be changed to use the new conformant behavior.
9999

docs/safeint/safeint-functions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: "SafeInt Functions"
3-
ms.date: "10/22/2018"
3+
ms.date: "06/23/2020"
44
ms.topic: "reference"
55
f1_keywords: ["SafeInt functions", "SafeAdd", "SafeCast", "SafeDivide", "SafeEquals", "SafeGreaterThan", "SafeGreaterThanEquals", "SafeLessThan", "SafeLessThanEquals", "SafeModulus", "SafeMultiply", "SafeNotEquals", "SafeSubtract"]
66
helpviewer_keywords: ["functions, SafeInt", "SafeAdd function", "SafeCast function", "SafeDivide function", "SafeEquals function", "SafeGreaterThan function", "SafeGreaterThanEquals function", "SafeLessThan function", "SafeLessThanEquals function", "SafeModulus function", "SafeMultiply function", "SafeNotEquals function", "SafeSubtract function"]
77
ms.assetid: fdc208e5-5d8a-41a9-8271-567fd438958d
88
---
99
# SafeInt Functions
1010

11-
The SafeInt library provides several functions that you can use without creating an instance of the [SafeInt class](safeint-class.md). If you want to protect a single mathematical operation from integer overflow, you can use these functions. If you want to protect multiple mathematical operations, you should create `SafeInt` objects. It is more efficient to create `SafeInt` objects than to use these functions multiple times.
11+
The SafeInt library provides several functions that you can use without creating an instance of the [SafeInt class](safeint-class.md). If you want to protect a single mathematical operation from integer overflow, you can use these functions. If you want to protect multiple mathematical operations, you should create `SafeInt` objects. It's more efficient to create `SafeInt` objects than to use these functions multiple times.
1212

1313
These functions enable you to compare or perform mathematical operations on two different types of parameters without having to convert them to the same type first.
1414

@@ -104,10 +104,10 @@ inline bool SafeDivide (
104104
### Parameters
105105

106106
*t*<br/>
107-
[in] The divisor. This must be of type T.
107+
[in] The dividend. This must be of type T.
108108

109109
*u*<br/>
110-
[in] The dividend. This must be of type U.
110+
[in] The divisor. This must be of type U.
111111

112112
*result*<br/>
113113
[out] The parameter where `SafeDivide` stores the result.
@@ -118,7 +118,7 @@ inline bool SafeDivide (
118118

119119
## <a name="safeequals"></a> SafeEquals
120120

121-
Compares two numbers to determine whether they are equal.
121+
Compares two numbers to determine whether they're equal.
122122

123123
```cpp
124124
template<typename T, typename U>
@@ -218,7 +218,7 @@ inline bool SafeLessThan (
218218
[in] The first number. This must be of type `T`.
219219

220220
*u*<br/>
221-
[in] The second numer. This must be of type `U`.
221+
[in] The second number. This must be of type `U`.
222222

223223
### Return Value
224224

@@ -314,7 +314,7 @@ inline bool SafeMultiply (
314314

315315
## <a name="safenotequals"></a> SafeNotEquals
316316

317-
Determines if two numbers are not equal.
317+
Determines if two numbers aren't equal.
318318

319319
```cpp
320320
template<typename T, typename U>
@@ -334,7 +334,7 @@ inline bool SafeNotEquals (
334334

335335
### Return Value
336336

337-
**true** if *t* and *u* are not equal; otherwise **false**.
337+
**true** if *t* and *u* aren't equal; otherwise **false**.
338338

339339
### Remarks
340340

docs/standard-library/iterators.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.assetid: 2f746be7-b37d-4bfc-bf05-be4336ca982f
88

99
An iterator is an object that can iterate over elements in a C++ Standard Library container and provide access to individual elements. The C++ Standard Library containers all provide iterators so that algorithms can access their elements in a standard way without having to be concerned with the type of container the elements are stored in.
1010

11-
You can use iterators explicitly using member and global functions such as `begin()` and `end()` and operators such as **++** and **--** to move forward or backward. You can also use iterators implicitly with a range-for loop or (for some iterator types) the subscript operator **\[]**.
11+
You can use iterators explicitly using member and global functions such as `begin()` and `end()` and operators such as `++` and `--` to move forward or backward. You can also use iterators implicitly with a range-for loop or (for some iterator types) the subscript operator `[]`.
1212

1313
In the C++ Standard Library, the beginning of a sequence or range is the first element. The end of a sequence or range is always defined as one past the last element. The global functions `begin` and `end` return iterators to a specified container. The typical explicit iterator loop over all elements in a container looks like this:
1414

@@ -33,17 +33,17 @@ for (auto num : vec)
3333

3434
There are five categories of iterators. In order of increasing power, the categories are:
3535

36-
- **Output**. An *output iterator* `X` can iterate forward over a sequence by using the **++** operator, and can write an element only once, by using the __\*__ operator.
36+
- **Output**. An *output iterator* `X` can iterate forward over a sequence by using the `++` operator, and can write an element only once, by using the __`*`__ operator.
3737

38-
- **Input**. An *input iterator* `X` can iterate forward over a sequence by using the ++ operator, and can read an element any number of times by using the **&ast;** operator. You can compare input iterators by using the **++** and **!=** operators. After you increment any copy of an input iterator, none of the other copies can safely be compared, dereferenced, or incremented thereafter.
38+
- **Input**. An *input iterator* `X` can iterate forward over a sequence by using the `++` operator, and can read an element any number of times by using the `*` operator. You can compare input iterators by using the `==` and `!=` operators. After you increment any copy of an input iterator, none of the other copies can safely be compared, dereferenced, or incremented afterwards.
3939

40-
- **Forward**. A *forward iterator* `X` can iterate forward over a sequence using the ++ operator and can read any element or write non-const elements any number of times by using the **&ast;** operator. You can access element members by using the **->** operator and compare forward iterators by using the **==** and **!=** operators. You can make multiple copies of a forward iterator, each of which can be dereferenced and incremented independently. A forward iterator that is initialized without reference to any container is called a *null forward iterator*. Null forward iterators always compare equal.
40+
- **Forward**. A *forward iterator* `X` can iterate forward over a sequence using the ++ operator and can read any element or write non-const elements any number of times by using the `*` operator. You can access element members by using the `->` operator and compare forward iterators by using the `==` and `!=` operators. You can make multiple copies of a forward iterator, each of which can be dereferenced and incremented independently. A forward iterator that is initialized without reference to any container is called a *null forward iterator*. Null forward iterators always compare equal.
4141

4242
- **Bidirectional**. A *bidirectional iterator* `X` can take the place of a forward iterator. You can, however, also decrement a bidirectional iterator, as in `--X`, `X--`, or `(V = *X--)`. You can access element members and compare bidirectional iterators in the same way as forward iterators.
4343

44-
- **Random access**. A *random-access iterator* `X` can take the place of a bidirectional iterator. With a random access iterator you can use the subscript operator **\[]** to access elements. You can use the **+**, **-**, **+=** and **-=** operators to move forward or backward a specified number of elements and to calculate the distance between iterators. You can compare bidirectional iterators by using **==**, **!=**, **\<**, **>**, **\<=**, and **>=**.
44+
- **Random access**. A *random-access iterator* `X` can take the place of a bidirectional iterator. With a random access iterator, you can use the subscript operator `[]` to access elements. You can use the `+`, `-`, `+=` and `-=` operators to move forward or backward a specified number of elements and to calculate the distance between iterators. You can compare bidirectional iterators by using `==`, `!=`, `<`, `>`, `<=`, and `>=`.
4545

46-
All iterators can be assigned or copied. They are assumed to be lightweight objects and are often passed and returned by value, not by reference. Note also that none of the operations previously described can throw an exception when performed on a valid iterator.
46+
All iterators can be assigned or copied. They're assumed to be lightweight objects and are often passed and returned by value, not by reference. Note also that none of the operations previously described can throw an exception when performed on a valid iterator.
4747

4848
The hierarchy of iterator categories can be summarized by showing three sequences. For write-only access to a sequence, you can use any of:
4949

@@ -71,9 +71,9 @@ Finally, for read/write access to a sequence, you can use any of:
7171
7272
An object pointer can always serve as a random-access iterator, so it can serve as any category of iterator if it supports the proper read/write access to the sequence it designates.
7373

74-
An iterator `Iterator` other than an object pointer must also define the member types required by the specialization `iterator_traits<Iterator>`. Note that these requirements can be met by deriving `Iterator` from the public base class [iterator](../standard-library/iterator-struct.md).
74+
An iterator `Iterator` other than an object pointer must also define the member types required by the specialization `iterator_traits<Iterator>`. These requirements can be met by deriving `Iterator` from the public base class [iterator](../standard-library/iterator-struct.md).
7575

76-
It is important to understand the promises and limitations of each iterator category to see how iterators are used by containers and algorithms in the C++ Standard Library.
76+
It's important to understand the promises and limitations of each iterator category to see how iterators are used by containers and algorithms in the C++ Standard Library.
7777

7878
> [!NOTE]
7979
> You can avoid using iterators explicitly by using range-for loops. For more information, see [Range-based for statement](../cpp/range-based-for-statement-cpp.md).

0 commit comments

Comments
 (0)