Skip to content

Commit 46a1495

Browse files
author
Colin Robertson
authored
Merge pull request #3012 from MicrosoftDocs/master637503992364892412
Repo sync for protected CLA branch
2 parents e6f22af + 7a73119 commit 46a1495

File tree

6 files changed

+85
-55
lines changed

6 files changed

+85
-55
lines changed

docs/build/cmake-remote-debugging.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ In this tutorial, you'll learn how to:
2626

2727
To set up Visual Studio for cross-platform C++ development, install the build tools for the target architecture. For this tutorial, install the ARM64 build tools by doing the following:
2828

29-
1. Run the Visual Studio Installer. If you haven't installed Visual Studio yet, see [Install Visual Studio](https://docs.microsoft.com/visualstudio/install/install-visual-studio#:~:text=Install%20Visual%20Studio%201%20Make%20sure%20your%20computer,...%204%20Choose%20workloads.%20...%20More%20items...%20)
29+
1. Run the Visual Studio Installer. If you haven't installed Visual Studio yet, see [Install Visual Studio](/visualstudio/install/install-visual-studio)
3030
1. On the Visual Studio Installer home screen, choose **Modify**.
3131
1. From the choices at the top, choose **Individual components**.
3232
1. Scroll down to the **Compilers, build tools, and runtimes** section.
@@ -37,8 +37,8 @@ To set up Visual Studio for cross-platform C++ development, install the build to
3737

3838
### On the remote machine
3939

40-
1. Install the remote tools on the remote machine. For this tutorial, install the ARM64 tools by following the instructions in [Download and Install the remote tools](https://docs.microsoft.com/visualstudio/debugger/remote-debugging-cpp?%23download-and-install-the-remote-tools#download-and-install-the-remote-tools).
41-
1. Start and configure the remote debugger on the remote machine. For this tutorial, do so by following the directions in [set up the remote debugger](https://docs.microsoft.com/visualstudio/debugger/remote-debugging-cpp?%23download-and-install-the-remote-tools#BKMK_setup) on the remote Windows machine.
40+
1. Install the remote tools on the remote machine. For this tutorial, install the ARM64 tools by following the instructions in [Download and Install the remote tools](/visualstudio/debugger/remote-debugging-cpp#download-and-install-the-remote-tools).
41+
1. Start and configure the remote debugger on the remote machine. For this tutorial, do so by following the directions in [set up the remote debugger](/visualstudio/debugger/remote-debugging-cpp#BKMK_setup) on the remote Windows machine.
4242

4343
## Create a CMake project
4444

docs/cpp/abstract-classes-cpp.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
---
2-
description: "Learn more about: Abstract Classes (C++)"
3-
title: "Abstract Classes (C++)"
4-
ms.date: "11/04/2016"
2+
description: "Learn more about: Abstract classes (C++)"
3+
title: "Abstract classes (C++)"
4+
ms.date: 02/18/2021
55
helpviewer_keywords: ["classes [C++], abstract", "base classes [C++], abstract classes [C++]", "abstract classes [C++]", "derived classes [C++], abstract classes [C++]"]
6-
ms.assetid: f0c5975b-39de-4d68-9640-6ce57f4632e6
76
---
8-
# Abstract Classes (C++)
7+
# Abstract classes (C++)
98

10-
Abstract classes act as expressions of general concepts from which more specific classes can be derived. You cannot create an object of an abstract class type; however, you can use pointers and references to abstract class types.
9+
Abstract classes act as expressions of general concepts from which more specific classes can be derived. You can't create an object of an abstract class type. However, you can use pointers and references to abstract class types.
1110

12-
A class that contains at least one pure virtual function is considered an abstract class. Classes derived from the abstract class must implement the pure virtual function or they, too, are abstract classes.
11+
You create an abstract class by declaring at least one pure virtual member function. That's a virtual function declared by using the pure specifier (`= 0`) syntax. Classes derived from the abstract class must implement the pure virtual function or they, too, are abstract classes.
1312

14-
Consider the example presented in [Virtual Functions](../cpp/virtual-functions.md). The intent of class `Account` is to provide general functionality, but objects of type `Account` are too general to be useful. Therefore, `Account` is a good candidate for an abstract class:
13+
Consider the example presented in [Virtual functions](../cpp/virtual-functions.md). The intent of class `Account` is to provide general functionality, but objects of type `Account` are too general to be useful. That means `Account` is a good candidate for an abstract class:
1514

1615
```cpp
1716
// deriv_AbstractClasses.cpp
@@ -30,7 +29,7 @@ The only difference between this declaration and the previous one is that `Print
3029
3130
## Restrictions on abstract classes
3231
33-
Abstract classes cannot be used for:
32+
Abstract classes can't be used for:
3433
3534
- Variables or member data
3635
@@ -40,42 +39,46 @@ Abstract classes cannot be used for:
4039
4140
- Types of explicit conversions
4241
43-
Another restriction is that if the constructor for an abstract class calls a pure virtual function, either directly or indirectly, the result is undefined. However, constructors and destructors for abstract classes can call other member functions.
42+
If the constructor for an abstract class calls a pure virtual function, either directly or indirectly, the result is undefined. However, constructors and destructors for abstract classes can call other member functions.
4443
45-
Pure virtual functions can be defined for abstract classes, but they can be called directly only by using the syntax:
44+
## Defined pure virtual functions
45+
46+
Pure virtual functions in abstract classes can be *defined*, or have an implementation. You can only call such functions by using the fully qualified syntax:
4647
4748
*abstract-class-name*::*function-name*()
4849
49-
This helps when designing class hierarchies whose base class(es) include pure virtual destructors, because base class destructors are always called in the process of destroying an object. Consider the following example:
50+
Defined pure virtual functions are helpful when you design class hierarchies whose base classes include pure virtual destructors. That's because base class destructors are always called during object destruction. Consider the following example:
5051
5152
```cpp
53+
// deriv_RestrictionsOnUsingAbstractClasses.cpp
5254
// Declare an abstract base class with a pure virtual destructor.
53-
// deriv_RestrictionsonUsingAbstractClasses.cpp
54-
class base {
55+
// It's the simplest possible abstract class.
56+
class base
57+
{
5558
public:
5659
base() {}
57-
virtual ~base()=0;
60+
virtual ~base() = 0 {}; // pure virtual, and defined!
5861
};
5962
60-
// Provide a definition for destructor.
61-
base::~base() {}
62-
63-
class derived:public base {
63+
class derived : public base
64+
{
6465
public:
6566
derived() {}
66-
~derived(){}
67+
~derived() {}
6768
};
6869
69-
int main() {
70-
derived *pDerived = new derived;
71-
delete pDerived;
70+
int main()
71+
{
72+
derived aDerived; // destructor called when it goes out of scope
7273
}
7374
```
7475

75-
When the object pointed to by `pDerived` is deleted, the destructor for class `derived` is called and then the destructor for class `base` is called. The empty implementation for the pure virtual function ensures that at least some implementation exists for the function.
76+
The example shows the definition of `~base()` inline, but you can also define it outside the class by using `base::~base() {}`.
77+
78+
When the object `aDerived` goes out of scope, the destructor for class `derived` is called. The compiler generates code to implicitly call the destructor for class `base` after the `derived` destructor. The empty implementation for the pure virtual function `~base` ensures that at least some implementation exists for the function. Without it, the linker generates an unresolved external symbol error for the implicit call.
7679

7780
> [!NOTE]
78-
> In the preceding example, the pure virtual function `base::~base` is called implicitly from `derived::~derived`. It is also possible to call pure virtual functions explicitly using a fully qualified member-function name.
81+
> In the preceding example, the pure virtual function `base::~base` is called implicitly from `derived::~derived`. It's also possible to call pure virtual functions explicitly by using a fully qualified member-function name. Such functions must have an implementation, or the call results in an error at link time.
7982
8083
## See also
8184
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
---
22
description: "Learn more about: Fatal Error C1047"
33
title: "Fatal Error C1047"
4-
ms.date: "11/04/2016"
4+
ms.date: 02/17/2021
55
f1_keywords: ["C1047"]
66
helpviewer_keywords: ["C1047"]
7-
ms.assetid: e1bbbc6b-a5bc-4c23-8203-488120a0ec78
87
---
98
# Fatal Error C1047
109

11-
The object or library file 'file' was created with an older compiler than other objects; rebuild old objects and libraries
10+
> The object or library file '*filename*' was created with an older compiler than other objects; rebuild old objects and libraries
1211
13-
C1047 is caused when object files or libraries built with **/LTCG** are linked together, but where those object files or libraries are built with different versions of the Visual C++ toolset.
12+
This error can happen if you use a new version of the compiler to build your project, but don't do a clean rebuild of existing object files or libraries.
1413

15-
This can happen if you begin using a new version of the compiler but do not do a clean rebuild of existing object files or libraries.
14+
## Remarks
1615

17-
To resolve C1047, rebuild all object files or libraries.
16+
C1047 is caused when object files or libraries built by using **`/GL`** or **`/LTCG`** in different versions of the Visual Studio C/C++ compiler toolset get linked together. For example, you can't link a **`/LTCG`** library built by using Visual Studio 2019 version 16.7 to an app built by using Visual Studio 2019 version 16.8. Both the major and minor update numbers of the toolset used to compile the objects and libraries must match exactly.
17+
18+
To resolve C1047, rebuild all object files or libraries by using the same version of the toolset.
19+
20+
## See also
21+
22+
[`/GL` (Whole Program Optimization)](../../build/reference/gl-whole-program-optimization.md)\
23+
[`/LTCG` (Link-time code generation)](../../build/reference/ltcg-link-time-code-generation.md)\
24+
[C++ binary compatibility 2015-2019](../../porting/binary-compat-2015-2017.md)

docs/error-messages/tool-errors/vectorizer-and-parallelizer-messages.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ For information about reason codes, refer to the next part of this article.
1717
| Informational message | Description |
1818
|--|--|
1919
| 5001 | Loop vectorized. |
20-
| 5002 | Loop not vectorized due to reason '*description*'. |
20+
| 5002 | Loop not vectorized because of reason '*description*'. |
2121
| 5011 | Loop parallelized. |
22-
| 5012 | Loop not parallelized due to reason '*description*'. |
22+
| 5012 | Loop not parallelized because of reason '*description*'. |
2323
| 5021 | Unable to associate loop with pragma. |
2424

2525
The following sections list possible reason codes for the parallelizer and vectorizer.
@@ -30,11 +30,12 @@ The 5*xx* reason codes apply to both the parallelizer and the vectorizer.
3030

3131
| Reason code | Explanation |
3232
|--|--|
33-
| 500 | A generic message that covers several cases—for example, the loop includes multiple exits, or the loop header doesn't end by incrementing the induction variable. |
33+
| 500 | A generic message that covers several cases: For example, the loop includes multiple exits, or the loop header doesn't end by incrementing the induction variable. |
3434
| 501 | Induction variable isn't local; or upper bound isn't loop-invariant. |
3535
| 502 | Induction variable is stepped in some manner other than a simple +1. |
3636
| 503 | Loop includes exception-handling or switch statements. |
3737
| 504 | Loop body may throw an exception that requires destruction of a C++ object. |
38+
| 505 | Outer loop has a pre-incremented induction variable. Exiting analysis. |
3839

3940
```cpp
4041
void code_500(int *A)
@@ -72,7 +73,7 @@ void code_501_example1(int *A)
7273
{
7374
// Code 501 is emitted if the compiler cannot discern the
7475
// induction variable of this loop. In this case, when it checks
75-
// the upperbound of 'i', the compiler cannot prove that the
76+
// the upper bound of 'i', the compiler cannot prove that the
7677
// function call "bound()" returns the same value each time.
7778
// Also, the compiler cannot prove that the call to "bound()"
7879
// does not modify the values of array A.
@@ -83,7 +84,7 @@ void code_501_example1(int *A)
8384
}
8485

8586
// To resolve code 501, ensure that the induction variable is
86-
// a local variable, and ensure that the upperbound is a
87+
// a local variable, and ensure that the upper bound is a
8788
// provably loop invariant value.
8889

8990
for (int i=0, imax = bound(); i<imax; ++i)
@@ -105,7 +106,7 @@ void code_501_example2(int *A)
105106
}
106107

107108
// To resolve code 501, ensure that the induction variable is
108-
// a local variable, and ensure that the upperbound is a
109+
// a local variable, and ensure that the upper bound is a
109110
// provably loop invariant value.
110111

111112
for (int i=0; i<1000; ++i)
@@ -173,7 +174,8 @@ public:
173174
~C504();
174175
};
175176

176-
void code_504(int *A) {
177+
void code_504(int *A)
178+
{
177179
// Code 504 is emitted if a C++ object was created and
178180
// that object requires EH unwind tracking information under
179181
// /EHs or /EHsc.
@@ -185,6 +187,23 @@ void code_504(int *A) {
185187
}
186188

187189
}
190+
191+
void code_505(int *A)
192+
{
193+
// Code 505 is emitted on outer loops with pre-incremented
194+
// induction variables. The vectorizer/parallelizer analysis
195+
// package doesn't support these loops, and they are
196+
// intentionally not converted to post-increment loops to
197+
// prevent a performance degradation.
198+
199+
// To parallelize an outer loop that causes code 505, change
200+
// it to a post-incremented loop.
201+
202+
for (int i=100; i--; )
203+
for (int j=0; j<100; j++) { // this loop is still vectorized
204+
A[j] = A[j] + 1;
205+
}
206+
}
188207
```
189208
190209
## <a name="BKMK_ReasonCode100x"></a> 10xx reason codes
@@ -201,7 +220,7 @@ The 10*xx* reason codes apply to the parallelizer.
201220
| 1005 | The `no_parallel` pragma was specified. |
202221
| 1006 | This function contains OpenMP. Resolve it by removing any OpenMP in this function. |
203222
| 1007 | The loop induction variable or the loop bounds aren't signed 32-bit numbers (`int` or `long`). Resolve it by changing the type of the induction variable. |
204-
| 1008 | The compiler detected that this loop doesn't perform enough work to justify auto-parallelization. |
223+
| 1008 | The compiler detected that this loop doesn't do enough work to justify auto-parallelization. |
205224
| 1009 | The compiler detected an attempt to parallelize a "`do`-`while`" loop. The auto-parallelizer only targets "`for`" loops. |
206225
| 1010 | The compiler detected that the loop is using "not-equals" (`!=`) for its condition. |
207226
@@ -403,7 +422,7 @@ The 11*xx* reason codes apply to the vectorizer.
403422
| Reason code | Explanation |
404423
|--|--|
405424
| 1100 | Loop contains control flow—for example, "`if`" or "`?:`". |
406-
| 1101 | Loop contains datatype conversion—perhaps implicit—that can't be vectorized. |
425+
| 1101 | Loop contains a (possibly implicit) datatype conversion that can't be vectorized. |
407426
| 1102 | Loop contains non-arithmetic or other non-vectorizable operations. |
408427
| 1103 | Loop body includes shift operations whose size might vary within the loop. |
409428
| 1104 | Loop body includes scalar variables. |
@@ -423,7 +442,7 @@ void code_1100(int *A, int x)
423442

424443
for (int i=0; i<1000; ++i)
425444
{
426-
// straightline code is more amenable to vectorization
445+
// straight line code is more amenable to vectorization
427446
if (x)
428447
{
429448
A[i] = A[i] + 1;
@@ -550,7 +569,7 @@ The 12*xx* reason codes apply to the vectorizer.
550569
551570
| Reason code | Explanation |
552571
|--|--|
553-
| 1200 | Loop contains loop-carried data dependencies that prevent vectorization. Different iterations of the loop interfere with each other such that vectorizing the loop would produce wrong answers, and the auto-vectorizer can't prove to itself that there are no such data dependences. |
572+
| 1200 | Loop contains loop-carried data dependencies that prevent vectorization. Different iterations of the loop interfere with each other such that vectorizing the loop would produce wrong answers, and the auto-vectorizer can't prove to itself that there aren't such data dependencies. |
554573
| 1201 | Array base changes during the loop. |
555574
| 1202 | Field in a struct isn't 32 or 64 bits wide. |
556575
| 1203 | Loop body includes non-contiguous accesses into an array. |
@@ -642,7 +661,7 @@ The 13*xx* reason codes apply to the vectorizer.
642661

643662
| Reason code | Explanation |
644663
|--|--|
645-
| 1300 | Loop body contains no—or very little—computation. |
664+
| 1300 | Loop body contains little or no computation. |
646665
| 1301 | Loop stride isn't +1. |
647666
| 1302 | Loop is a "`do`-`while`". |
648667
| 1303 | Too few loop iterations for vectorization to provide value. |
@@ -692,7 +711,7 @@ int code_1303(int *A, int *B)
692711
// make vectorization profitable.
693712

694713
// If the loop computation fits perfectly in
695-
// vector registers - for example, the upperbound is 4, or 8 in
714+
// vector registers - for example, the upper bound is 4, or 8 in
696715
// this case - then the loop _may_ be vectorized.
697716

698717
// This loop is not vectorized because there are 5 iterations

docs/overview/whats-new-cpp-docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ For the latest C++ conformance status, see [C++ conformance improvements in Visu
192192

193193
## Community contributors
194194

195-
The following people contributed to the C++, C, and Assembler docs during this period. Thank you! See [Microsoft Docs contributor guide overview](https://docs.microsoft.com/contribute/) if you'd like to learn how to contribute.
195+
The following people contributed to the C++, C, and Assembler docs during this period. Thank you! See [Microsoft Docs contributor guide overview](/contribute/) if you'd like to learn how to contribute.
196196

197197
- [yecril71pl](https://github.com/yecril71pl) - Christopher Yeleighton (4)
198198
- [definedrisk](https://github.com/definedrisk) - Ben (3)

0 commit comments

Comments
 (0)