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
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