Skip to content

Commit 7c6f107

Browse files
authored
Merge pull request #5072 from MicrosoftDocs/FromPublicMasterBranch
Confirm merge from FromPublicMasterBranch to main to sync with https://github.com/MicrosoftDocs/cpp-docs (branch main)
2 parents 8f1daa9 + 5bde614 commit 7c6f107

40 files changed

+73
-68
lines changed

docs/c-runtime-library/reference/chdir-wchdir.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ For more compatibility information, see [Compatibility](../compatibility.md).
7878
7979
int main( int argc, char *argv[] )
8080
{
81-
8281
if(_chdir( argv[1] ) )
8382
{
8483
switch (errno)

docs/c-runtime-library/reference/chmod-wchmod.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ void set_mode_and_report(char * filename, int mask)
114114
115115
int main( void )
116116
{
117-
118117
// Create or append to a file.
119118
system( "echo /* End of file */ >> crt_chmod.c_input" );
120119

docs/c-runtime-library/reference/cputs-cputws.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ void wprint_to_console(wchar_t* wbuffer)
106106

107107
int main()
108108
{
109-
110109
// String to print at console.
111110
// Notice the \r (return) character.
112111
char* buffer = "Hello world (courtesy of _cputs)!\r\n";

docs/c-runtime-library/reference/pipe.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ enum PIPES { READ, WRITE }; /* Constants 0 and 1 for READ and WRITE */
105105

106106
int main( int argc, char *argv[] )
107107
{
108-
109108
int fdpipe[2];
110109
char hstr[20];
111110
int pid, problem, c;

docs/code-quality/c6014.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ const int TEST_DATA [ARRAYSIZE] = {10,20,30,40,50,60,70,80,90,100};
9797

9898
void f( )
9999
{
100-
101100
unique_ptr<int[]> p(new int[ARRAYSIZE]);
102101
std::copy(begin(TEST_DATA), end(TEST_DATA), p.get());
103102

docs/cpp/class-templates.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ using namespace std;
8383

8484
class X
8585
{
86-
8786
template <class T>
8887
struct Y
8988
{

docs/cpp/codesnippet/CPP/how-to-create-and-use-ccomptr-and-ccomqiptr-instances_1.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
void CComPtrDemo()
22
{
3-
43
HRESULT hr = CoInitialize(NULL);
54

65
// Declare the smart pointer.

docs/cpp/codesnippet/CPP/how-to-create-and-use-ccomptr-and-ccomqiptr-instances_3.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
void COMAutomationSmartPointerDemo()
22
{
3-
43
CComPtr<IDispatch> pWord;
54
CComQIPtr<IDispatch, &IID_IDispatch> pqi = pWord;
65
CComDispatchDriver pDriver = pqi;

docs/cpp/examples-of-lambda-expressions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Because a lambda expression is typed, you can assign it to an **`auto`** variabl
2323

2424
int main()
2525
{
26-
2726
using namespace std;
2827

2928
// Assign the lambda expression that adds two numbers to an auto variable.

docs/cpp/function-overloading.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ using namespace std;
401401

402402
class C
403403
{
404-
405404
public:
406405
C() {/*expensive initialization*/}
407406
vector<unsigned> get_data() &

docs/cpp/if-else-statement-cpp.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int getValue() { return 42; }
131131

132132
int main()
133133
{
134-
135134
if (auto it = m.find(10); it != m.end())
136135
{
137136
cout << it->second << "\n";

docs/cpp/raw-pointers.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ void func(int arr[], int length)
150150
151151
int main()
152152
{
153-
154153
int i[5]{ 1,2,3,4,5 };
155154
// sizeof(i) = total bytes
156155
int j = sizeof(i) / sizeof(i[0]);
@@ -170,7 +169,6 @@ using namespace std;
170169

171170
int main()
172171
{
173-
174172
BITMAPINFOHEADER header;
175173
header.biHeight = 100; // Multiple of 4 for simplicity.
176174
header.biWidth = 100;

docs/error-messages/compiler-errors-1/compiler-error-c2058.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@ ms.assetid: 81e08e6b-15f7-41b4-980a-53763e19990c
1111
constant expression is not integral
1212

1313
The context requires an integer constant expression.
14+
15+
The following sample generates C2058:
16+
17+
```cpp
18+
// C2058.cpp
19+
struct alignas(1.5) S {}; // C2058
20+
21+
int main() {
22+
int arr[1.5]; // C2058
23+
}
24+
```
25+
26+
To resolve the issue, use an integer constant expression. For example, `int arr[2];`

docs/error-messages/compiler-errors-1/compiler-error-c2082.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ The following sample generates C2082:
1616

1717
```cpp
1818
// C2082.cpp
19-
void func(int i) {
20-
int i; // C2082
21-
int ii; // OK
19+
void func(int num1) {
20+
int num1; // C2082
21+
int num2; // OK
22+
23+
auto lambda1 = [](int num1){ int num1; }; // C2082
24+
auto lambda2 = [](int num1){ int num2; }; // OK
2225
}
2326
```

docs/error-messages/compiler-errors-2/compiler-error-c2504.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.assetid: c9e002a6-a4ee-4ba7-970e-edf4adb83692
1010

1111
'class' : base class undefined
1212

13-
The base class is declared but never defined. Possible causes:
13+
The base class is declared but never defined. Possible causes:
1414

1515
1. Missing include file.
1616

@@ -23,11 +23,7 @@ The following sample generates C2504:
2323
// compile with: /c
2424
class A;
2525
class B : public A {}; // C2504
26-
```
27-
28-
// OK
2926

30-
```
31-
class C{};
32-
class D : public C {};
27+
class C {};
28+
class D : public C {}; // OK
3329
```

docs/error-messages/compiler-errors-2/compiler-error-c2992.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,34 @@ The following sample generates C2992:
2020
// C2992.cpp
2121
// compile with: /c
2222
template <class T>
23-
struct TC1 {
23+
struct Outer {
2424
template <class U>
25-
struct TC2;
25+
struct Inner;
2626
};
2727

28-
template <class T> struct TC1<T>::TC2 {}; // C2992
28+
template <class T> // C2992
29+
struct Outer<T>::Inner {};
2930

30-
// OK
3131
template <class T>
32-
template <class U>
33-
struct TC1<T>::TC2 {};
34-
// C2992 can also occur when using generics:
35-
// C2992c.cpp
36-
// compile with: /clr /c
32+
template <class U> // OK
33+
struct Outer<T>::Inner {};
34+
```
35+
36+
C2992 can also occur when using generics:
37+
38+
```cpp
39+
// C2992b.cpp
40+
// compile with: /c /clr
3741
generic <class T>
38-
ref struct GC1 {
42+
ref struct Outer {
3943
generic <class U>
40-
ref struct GC2;
44+
ref struct Inner;
4145
};
4246
43-
generic <class T> ref struct GC1<T>::GC2 {}; // C2992
47+
generic <class T> // C2992
48+
ref struct Outer<T>::Inner {};
4449
45-
// OK
4650
generic <class T>
47-
generic <class U>
48-
ref struct GC1<T>::GC2 {};
51+
generic <class U> // OK
52+
ref struct Outer<T>::Inner {};
4953
```

docs/standard-library/algorithm-functions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5091,7 +5091,6 @@ void PrintResult(const string& msg, const pair<vector<int>::iterator, vector<int
50915091

50925092
int main()
50935093
{
5094-
50955094
vector<int> vec_1{ 0, 5, 10, 15, 20, 25 };
50965095
vector<int> vec_2{ 0, 5, 10, 15, 20, 25, 30 };
50975096

docs/standard-library/bitset-operators.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ The template function extracts elements from *i_str* and inserts them into the b
162162
using namespace std;
163163
int main()
164164
{
165-
166165
bitset<5> b1;
167166
cout << "Enter string of (0 or 1) bits for input into bitset<5>.\n"
168167
<< "Try bit string of length less than or equal to 5,\n"

docs/standard-library/function-class.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ private:
225225

226226
int main()
227227
{
228-
229228
typedef std::vector< std::function<int (int)> > vf_t;
230229

231230
vf_t v;

docs/standard-library/greater-equal-struct.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ template <>
2424
struct greater_equal<void>
2525
{
2626
template <class T, class U>
27-
auto operator()(T&& Left, U&& Right) const`
27+
auto operator()(T&& Left, U&& Right) const
2828
-> decltype(std::forward<T>(Left)>= std::forward<U>(Right));
2929
};
3030
```

docs/standard-library/hash-compare-class.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ The class template describes an object that can be used by any of the hash assoc
1212

1313
## Syntax
1414

15+
```cpp
1516
class hash_compare
16-
{
17+
{
1718
Traits comp;
1819
public:
1920
const size_t bucket_size = 4;
@@ -24,7 +25,8 @@ class hash_compare
2425
bool operator()(
2526
const Key& key1,
2627
const Key& key2) const;
27-
};
28+
};
29+
```
2830
2931
## Remarks
3032

docs/standard-library/input-iterator-tag-struct.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ A class that provides a return type for `iterator_category` function that repres
1212

1313
## Syntax
1414

15+
```cpp
1516
struct input_iterator_tag {};
17+
```
1618
1719
## Remarks
1820

docs/standard-library/is-placeholder-class.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ Tests if type is a placeholder.
1212

1313
## Syntax
1414

15+
```cpp
1516
struct is_placeholder {
1617
static const int value;
1718
};
19+
```
1820
1921
## Remarks
2022

docs/standard-library/logical-and-struct.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ template <>
2424
struct logical_and<void>
2525
{
2626
template <class T, class U>
27-
auto operator()(T&& Left, U&& Right) const`
27+
auto operator()(T&& Left, U&& Right) const
2828
-> decltype(std::forward<T>(Left) && std::forward<U>(Right));
2929
};
3030
```

docs/standard-library/logical-not-struct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A predefined function object that performs the logical not operation (`operator!
1212

1313
## Syntax
1414

15-
```
15+
```cpp
1616
template <class Type = void>
1717
struct logical_not : public unary_function<Type, bool>
1818
{
@@ -24,7 +24,7 @@ template <>
2424
struct logical_not<void>
2525
{
2626
template <class Type>
27-
auto operator()(Type&& Left) const`
27+
auto operator()(Type&& Left) const
2828
-> decltype(!std::forward<Type>(Left));
2929
};
3030
```

docs/standard-library/logical-or-struct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A predefined function object that performs the logical disjunction operation ( `
1212

1313
## Syntax
1414

15-
```
15+
```cpp
1616
template <class Type = void>
1717
struct logical_or : public binary_function<Type, Type, bool>
1818
{
@@ -24,7 +24,7 @@ template <>
2424
struct logical_or<void>
2525
{
2626
template <class T, class U>
27-
auto operator()(T&& Left, U&& Right) const`
27+
auto operator()(T&& Left, U&& Right) const
2828
-> decltype(std::forward<T>(Left) || std::forward<U>(Right));
2929
};
3030
```

docs/standard-library/map-class.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,6 @@ template <typename M> void print(const M& m) {
14341434

14351435
int main()
14361436
{
1437-
14381437
// insert single values
14391438
map<int, int> m1;
14401439
// call insert(const value_type&) version

docs/standard-library/minus-struct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A predefined function object that performs the subtraction operation (binary `op
1212

1313
## Syntax
1414

15-
```
15+
```cpp
1616
template <class Type = void>
1717
struct minus : public binary_function <Type, Type, Type>
1818
{
@@ -24,7 +24,7 @@ template <>
2424
struct minus<void>
2525
{
2626
template <class T, class U>
27-
auto operator()(T&& Left, U&& Right) const`
27+
auto operator()(T&& Left, U&& Right) const
2828
-> decltype(std::forward<T>(Left) - std::forward<U>(Right));
2929
};
3030
```

docs/standard-library/modulus-struct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A predefined function object that performs the modulus division operation (`oper
1212

1313
## Syntax
1414

15-
```
15+
```cpp
1616
template <class Type = void>
1717
struct modulus : public binary_function <Type, Type, Type>
1818
{
@@ -24,7 +24,7 @@ template <>
2424
struct modulus<void>
2525
{
2626
template <class T, class U>
27-
auto operator()(T&& Left, U&& Right) const`
27+
auto operator()(T&& Left, U&& Right) const
2828
-> decltype(std::forward<T>(Left) % std::forward<U>(Right));
2929
};
3030
```

docs/standard-library/multimap-class.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,6 @@ template <typename M> void print(const M& m) {
12461246

12471247
int main()
12481248
{
1249-
12501249
// insert single values
12511250
multimap<int, int> m1;
12521251
// call insert(const value_type&) version

docs/standard-library/multiplies-struct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A predefined function object that performs the multiplication operation (binary
1212

1313
## Syntax
1414

15-
```
15+
```cpp
1616
template <class Type = void>
1717
struct multiplies : public binary_function <Type, Type, Type>
1818
{
@@ -24,7 +24,7 @@ template <>
2424
struct multiplies<void>
2525
{
2626
template <class T, class U>
27-
auto operator()(T&& Left, U&& Right) const`
27+
auto operator()(T&& Left, U&& Right) const
2828
-> decltype(std::forward<T>(Left) * std::forward<U>(Right));
2929
};
3030
```

0 commit comments

Comments
 (0)