Skip to content

Commit 4fc6869

Browse files
authored
Merge pull request #811 from MicrosoftDocs/master
5/15 AM Publishing
2 parents 3958567 + 12d8713 commit 4fc6869

14 files changed

+460
-256
lines changed

docs/build/register-usage.md

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Register Usage | Microsoft Docs"
2+
title: "Register usage | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "11/04/2016"
55
ms.technology: ["cpp-tools"]
@@ -10,34 +10,41 @@ author: "corob-msft"
1010
ms.author: "corob"
1111
ms.workload: ["cplusplus"]
1212
---
13-
# Register Usage
14-
The [!INCLUDE[vcprx64](../assembler/inline/includes/vcprx64_md.md)] architecture provides for 16 general-purpose registers (hereafter referred to as integer registers) as well as 16 XMM/YMM registers available for floating-point use. Volatile registers are scratch registers presumed by the caller to be destroyed across a call. Nonvolatile registers are required to retain their values across a function call and must be saved by the callee if used.
15-
16-
The following table describes how each register is used across function calls:
17-
18-
||||
19-
|-|-|-|
20-
|Register|Status|Use|
21-
|RAX|Volatile|Return value register|
22-
|RCX|Volatile|First integer argument|
23-
|RDX|Volatile|Second integer argument|
24-
|R8|Volatile|Third integer argument|
25-
|R9|Volatile|Fourth integer argument|
26-
|R10:R11|Volatile|Must be preserved as needed by caller; used in syscall/sysret instructions|
27-
|R12:R15|Nonvolatile|Must be preserved by callee|
28-
|RDI|Nonvolatile|Must be preserved by callee|
29-
|RSI|Nonvolatile|Must be preserved by callee|
30-
|RBX|Nonvolatile|Must be preserved by callee|
31-
|RBP|Nonvolatile|May be used as a frame pointer; must be preserved by callee|
32-
|RSP|Nonvolatile|Stack pointer|
33-
|XMM0, YMM0|Volatile|First FP argument; first vector-type argument when `__vectorcall` is used|
34-
|XMM1, YMM1|Volatile|Second FP argument; second vector-type argument when `__vectorcall` is used|
35-
|XMM2, YMM2|Volatile|Third FP argument; third vector-type argument when `__vectorcall` is used|
36-
|XMM3, YMM3|Volatile|Fourth FP argument; fourth vector-type argument when `__vectorcall` is used|
37-
|XMM4, YMM4|Volatile|Must be preserved as needed by caller; fifth vector-type argument when `__vectorcall` is used|
38-
|XMM5, YMM5|Volatile|Must be preserved as needed by caller; sixth vector-type argument when `__vectorcall` is used|
39-
|XMM6:XMM15, YMM6:YMM15|Nonvolatile (XMM), Volatile (upper half of YMM)|Must be preserved by callee. YMM registers must be preserved as needed by caller.|
40-
41-
## See Also
42-
[x64 Software Conventions](../build/x64-software-conventions.md)
43-
[__vectorcall](../cpp/vectorcall.md)
13+
# Register usage
14+
15+
The x64 architecture provides for 16 general-purpose registers (hereafter referred to as integer registers) as well as 16 XMM/YMM registers available for floating-point use. Volatile registers are scratch registers presumed by the caller to be destroyed across a call. Nonvolatile registers are required to retain their values across a function call and must be saved by the callee if used.
16+
17+
## Register volatility and preservation
18+
19+
The following table describes how each register is used across function calls:
20+
21+
||||
22+
|-|-|-|
23+
|Register|Status|Use|
24+
|RAX|Volatile|Return value register|
25+
|RCX|Volatile|First integer argument|
26+
|RDX|Volatile|Second integer argument|
27+
|R8|Volatile|Third integer argument|
28+
|R9|Volatile|Fourth integer argument|
29+
|R10:R11|Volatile|Must be preserved as needed by caller; used in syscall/sysret instructions|
30+
|R12:R15|Nonvolatile|Must be preserved by callee|
31+
|RDI|Nonvolatile|Must be preserved by callee|
32+
|RSI|Nonvolatile|Must be preserved by callee|
33+
|RBX|Nonvolatile|Must be preserved by callee|
34+
|RBP|Nonvolatile|May be used as a frame pointer; must be preserved by callee|
35+
|RSP|Nonvolatile|Stack pointer|
36+
|XMM0, YMM0|Volatile|First FP argument; first vector-type argument when `__vectorcall` is used|
37+
|XMM1, YMM1|Volatile|Second FP argument; second vector-type argument when `__vectorcall` is used|
38+
|XMM2, YMM2|Volatile|Third FP argument; third vector-type argument when `__vectorcall` is used|
39+
|XMM3, YMM3|Volatile|Fourth FP argument; fourth vector-type argument when `__vectorcall` is used|
40+
|XMM4, YMM4|Volatile|Must be preserved as needed by caller; fifth vector-type argument when `__vectorcall` is used|
41+
|XMM5, YMM5|Volatile|Must be preserved as needed by caller; sixth vector-type argument when `__vectorcall` is used|
42+
|XMM6:XMM15, YMM6:YMM15|Nonvolatile (XMM), Volatile (upper half of YMM)|Must be preserved by callee. YMM registers must be preserved as needed by caller.|
43+
44+
On function exit and on function entry to C Runtime Library calls and Windows system calls, the direction flag in the CPU flags register is expected to be cleared.
45+
46+
## See also
47+
48+
- [x64 Software Conventions](../build/x64-software-conventions.md)
49+
- [__vectorcall](../cpp/vectorcall.md)
50+
- [Direction flag](../c-runtime-library/direction-flag.md)

docs/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ Converts a **time_t** time value to a **tm** structure, and corrects for the loc
2323

2424
```C
2525
errno_t localtime_s(
26-
struct tm* tmDest,
27-
const time_t *sourceTime
26+
struct tm* const tmDest,
27+
time_t const* const sourceTime
2828
);
2929
errno_t _localtime32_s(
3030
struct tm* tmDest,
31-
const time32_t *sourceTime
31+
__time32_t const* sourceTime
3232
);
3333
errno_t _localtime64_s(
3434
struct tm* tmDest,
35-
const _time64_t *sourceTime
35+
__time64_t const* sourceTime
3636
);
3737
```
3838

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,25 @@ ms.workload: ["cplusplus"]
1414
---
1515
# Compiler Error C2482
1616

17-
>'*identifier*' : dynamic initialization of 'thread' data not allowed
17+
>'*identifier*' : dynamic initialization of 'thread' data not allowed in managed/WinRT code
1818
19-
This error message is obsolete in Visual Studio 2015 and later versions. In previous versions, variables declared by using the `thread` attribute cannot be initialized with an expression that requires run-time evaluation. A static expression is required to initialize `thread` data.
19+
## Remarks
20+
21+
In managed or WinRT code, variables declared by using the [__declspec(thread)](../../cpp/thread.md) storage class modifier attribute or the [thread_local](../../cpp/storage-classes-cpp.md#thread_local) storage class specifier cannot be initialized with an expression that requires evaluation at run-time. A static expression is required to initialize `__declspec(thread)` or `thread_local` data in these runtime environments.
2022

2123
## Example
2224

23-
The following sample generates C2482 in Visual Studio 2013 and earlier:
25+
The following sample generates C2482 in managed (**/clr**) and in WinRT (**/ZW**) code:
2426

2527
```cpp
2628
// C2482.cpp
27-
// compile with: /c
29+
// For managed example, compile with: cl /EHsc /c /clr C2482.cpp
30+
// For WinRT example, compile with: cl /EHsc /c /ZW C2482.cpp
2831
#define Thread __declspec( thread )
29-
Thread int tls_i = tls_i; // C2482
32+
Thread int tls_i1 = tls_i1; // C2482
3033

3134
int j = j; // OK in C++; C error
32-
Thread int tls_i = sizeof( tls_i ); // Okay in C and C++
35+
Thread int tls_i2 = sizeof( tls_i2 ); // Okay in C and C++
3336
```
37+
38+
To fix this issue, initialize thread-local storage by using a constant, **constexpr**, or static expression. Perform any thread-specific initialization separately.

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4067.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,45 @@ ms.author: "corob"
1313
ms.workload: ["cplusplus"]
1414
---
1515
# Compiler Warning (level 1) C4067
16-
unexpected tokens following preprocessor directive - expected a newline
17-
18-
The compiler found and ignored extra characters following a preprocessor directive. This warning appears only under ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)).
19-
20-
```
21-
// C4067a.cpp
22-
// compile with: /DX /Za /W1
23-
#pragma warning(default:4067)
24-
#if defined(X)
25-
#else
26-
#endif v // C4067
27-
int main()
28-
{
29-
}
30-
```
31-
32-
### To resolve this warning, try the following:
33-
34-
1. Compile with **/Ze**.
35-
36-
2. Use comment delimiters:
37-
38-
```
39-
// C4067b.cpp
40-
// compile with: /DX /Za /W1
41-
#if defined(X)
42-
#else
43-
#endif
44-
int main()
45-
{
46-
}
16+
17+
> unexpected tokens following preprocessor directive - expected a newline
18+
19+
## Remarks
20+
21+
The compiler found and ignored extra characters following a preprocessor directive. This can be caused by any unexpected characters, though a common cause is a stray semicolon after the directive. Comments do not cause this warning. The **/Za** compiler option enables this warning for more preprocessor directives than the default setting.
22+
23+
## Example
24+
25+
```cpp
26+
// C4067a.cpp
27+
// compile with: cl /EHsc /DX /W1 /Za C4067a.cpp
28+
#include <iostream>
29+
#include <string> s // C4067
30+
#if defined(X); // C4067
31+
std::string s{"X is defined"};
32+
#else
33+
std::string s{"X is not defined"};
34+
#endif; // C4067 only under /Za
35+
int main()
36+
{
37+
std::cout << s << std::endl;
38+
}
39+
```
40+
41+
To resolve this warning, delete the stray characters, or move them into a comment block. Certain C4067 warnings may be disabled by removing the **/Za** compiler option.
42+
43+
```cpp
44+
// C4067b.cpp
45+
// compile with: cl /EHsc /DX /W1 C4067b.cpp
46+
#include <iostream>
47+
#include <string>
48+
#if defined(X)
49+
std::string s{"X is defined"};
50+
#else
51+
std::string s{"X is not defined"};
52+
#endif
53+
int main()
54+
{
55+
std::cout << s << std::endl;
56+
}
4757
```
Lines changed: 61 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Compiler Warning (level 1) C4503 | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "05/14/2018"
55
ms.technology: ["cpp-diagnostics"]
66
ms.topic: "error-reference"
77
f1_keywords: ["C4503"]
@@ -13,56 +13,64 @@ ms.author: "corob"
1313
ms.workload: ["cplusplus"]
1414
---
1515
# Compiler Warning (level 1) C4503
16-
'identifier' : decorated name length exceeded, name was truncated
17-
18-
The decorated name was longer than the compiler limit (4096), and was truncated. To avoid this warning and the truncation, reduce the number of arguments or name length of identifiers used.
19-
20-
One situation where this warning will be issued is when your code contains templates specialized on templates repeatedly. For example, a map of maps (from the C++ Standard Library). In this situation, you can make your typedefs a type (struct, for example) that contains the map.
21-
22-
You might, however, decide to not restructure your code. It is possible to ship an application that generates C4503, but if you get link time errors on a truncated symbol, it will be more difficult to determine the type of the symbol in the error. Debugging will also be more difficult; the debugger will also have difficultly mapping symbol name to type name. The correctness of the program, however, is unaffected by the truncated name.
23-
24-
The following sample generates C4503:
25-
26-
```
27-
// C4503.cpp
28-
// compile with: /W1 /EHsc /c
29-
// C4503 expected
30-
#include <string>
31-
#include <map>
32-
33-
class Field{};
34-
35-
typedef std::map<std::string, Field> Screen;
36-
typedef std::map<std::string, Screen> WebApp;
37-
typedef std::map<std::string, WebApp> WebAppTest;
38-
typedef std::map<std::string, WebAppTest> Hello;
39-
Hello MyWAT;
40-
```
41-
42-
The following sample shows one way to rewrite your code to resolve C4503:
43-
44-
```
45-
// C4503b.cpp
46-
// compile with: /W1 /EHsc /c
47-
#include <string>
48-
#include <map>
49-
50-
class Field{};
51-
struct Screen2 {
52-
std::map<std::string, Field> Element;
53-
};
54-
55-
struct WebApp2 {
56-
std::map<std::string, Screen2> Element;
57-
};
58-
59-
struct WebAppTest2 {
60-
std::map<std::string, WebApp2> Element;
61-
};
62-
63-
struct Hello2 {
64-
std::map<std::string, WebAppTest2> Element;
65-
};
66-
67-
Hello2 MyWAT2;
16+
17+
> '*identifier*' : decorated name length exceeded, name was truncated
18+
19+
## Remarks
20+
21+
This compiler warning is obsolete and is not generated in Visual Studio 2017 and later compilers.
22+
23+
The decorated name was longer than the compiler limit (4096), and was truncated. To avoid this warning and the truncation, reduce the number of arguments or the name lengths of identifiers used. Decorated names that are longer than the compiler limit have a hash applied and are not in danger of a name collision.
24+
25+
When using an older version of Visual Studio, this warning can be issued when your code contains templates specialized on templates repeatedly. For example, a map of maps (from the C++ Standard Library). In this situation, you can make your typedefs a type (a **struct**, for example) that contains the map.
26+
27+
You might, however, decide to not restructure your code. It is possible to ship an application that generates C4503, but if you get link time errors on a truncated symbol, it can be more difficult to determine the type of the symbol in the error. Debugging may also be more difficult; the debugger may have difficultly mapping the symbol name to the type name. The correctness of the program, however, is unaffected by the truncated name.
28+
29+
## Example
30+
31+
The following sample generates C4503 in compilers before Visual Studio 2017:
32+
33+
```cpp
34+
// C4503.cpp
35+
// compile with: /W1 /EHsc /c
36+
// C4503 expected
37+
#include <string>
38+
#include <map>
39+
40+
class Field{};
41+
42+
typedef std::map<std::string, Field> Screen;
43+
typedef std::map<std::string, Screen> WebApp;
44+
typedef std::map<std::string, WebApp> WebAppTest;
45+
typedef std::map<std::string, WebAppTest> Hello;
46+
Hello MyWAT;
47+
```
48+
49+
This sample shows one way to rewrite your code to resolve C4503:
50+
51+
```cpp
52+
// C4503b.cpp
53+
// compile with: /W1 /EHsc /c
54+
#include <string>
55+
#include <map>
56+
57+
class Field{};
58+
59+
struct Screen2 {
60+
std::map<std::string, Field> Element;
61+
};
62+
63+
struct WebApp2 {
64+
std::map<std::string, Screen2> Element;
65+
};
66+
67+
struct WebAppTest2 {
68+
std::map<std::string, WebApp2> Element;
69+
};
70+
71+
struct Hello2 {
72+
std::map<std::string, WebAppTest2> Element;
73+
};
74+
75+
Hello2 MyWAT2;
6876
```

docs/ide/TOC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
## [Understanding the Dependencies of a Visual C++ Application](understanding-the-dependencies-of-a-visual-cpp-application.md)
7272
## [Determining Which DLLs to Redistribute](determining-which-dlls-to-redistribute.md)
7373
## [Choosing a Deployment Method](choosing-a-deployment-method.md)
74+
## [Universal CRT deployment](universal-crt-deployment.md)
7475
## [Redistributing Visual C++ Files](redistributing-visual-cpp-files.md)
7576
### [Redistributing Components By Using Merge Modules](redistributing-components-by-using-merge-modules.md)
7677
### [Redistributing Visual C++ ActiveX Controls](redistributing-visual-cpp-activex-controls.md)

0 commit comments

Comments
 (0)