You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f3137d6
Browse filesBrowse the repository at this point in the historyBrowse files
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.|
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.
Copy file name to clipboardExpand all lines: docs/error-messages/compiler-errors-1/compiler-error-c2482.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,20 +14,25 @@ ms.workload: ["cplusplus"]
14
14
---
15
15
# Compiler Error C2482
16
16
17
-
>'*identifier*' : dynamic initialization of 'thread' data not allowed
17
+
>'*identifier*' : dynamic initialization of 'thread' data not allowed in managed/WinRT code
18
18
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.
20
22
21
23
## Example
22
24
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:
24
26
25
27
```cpp
26
28
// 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
28
31
#defineThread__declspec( thread )
29
-
Thread int tls_i = tls_i; // C2482
32
+
Thread int tls_i1 = tls_i1; // C2482
30
33
31
34
int j = j; // OK in C++; C error
32
-
Thread inttls_i = sizeof( tls_i ); // Okay in C and C++
35
+
Thread inttls_i2 = sizeof( tls_i2 ); // Okay in C and C++
33
36
```
37
+
38
+
To fix this issue, initialize thread-local storage by using a constant, **constexpr**, or static expression. Perform any thread-specific initialization separately.
Copy file name to clipboardExpand all lines: docs/error-messages/compiler-warnings/compiler-warning-level-1-c4067.md
+41-31Lines changed: 41 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,35 +13,45 @@ ms.author: "corob"
13
13
ms.workload: ["cplusplus"]
14
14
---
15
15
# 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
+
intmain()
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.
title: "Compiler Warning (level 1) C4503 | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "05/14/2018"
5
5
ms.technology: ["cpp-diagnostics"]
6
6
ms.topic: "error-reference"
7
7
f1_keywords: ["C4503"]
@@ -13,56 +13,64 @@ ms.author: "corob"
13
13
ms.workload: ["cplusplus"]
14
14
---
15
15
# 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
+
classField{};
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:
0 commit comments