String Literals

The compiler may generate a symbolic name for a string literal, most notably so that subsequent references to the same constant string data can be resolved to a one and only instance of this string instead of to multiple, redundant, instances of the same string. Such compiler-generated names for string literals fit loosely into the scheme of decorations of built-in objects (as if ?_C is the name and there is no scope). The general form is


for a char array but


if the string is an array of the wchar_t type (or unsigned short if /Zc:wchar_t is not active).

The first two fields show respectively the length of the string (in bytes, including the null terminator) and a checksum of all the bytes in the string (again including the null terminator). Both are represented as numeric fields (i.e., as a sequence of letters A to P terminated by an @ sign, or as a single digit 0 to 9 with no @ sign).

The text field shows as many as 20 characters from the start of the string, up to and including the terminating null. For a char string, the representation shows each byte in turn. The representation of a wchar_t string shows the high byte first in each character. Alphanumeric bytes are simply reproduced, as are dollar signs and underscores. Others are translated, the general form being:


where h and l represent the high and low hexadecimal digit respectively as a letter from A to P inclusive (A for 0x00 to P for 0x0F). For instance, a dollar sign as a byte in a string literal translates to ?$CE in the symbolic name. Simplifications are provided as special cases for some common punctuators (and for some less common characters from the upper half of the ASCII tables):

?0 comma
?1 forward slash
?2 backslash
?3 colon
?4 period
?5 space
?6 new-line
?7 tab
?8 single quote
?9 hyphen
?A to ?Z ASCII 0xC1 to 0xDA
?a to ?z ASCII 0xE1 to 0xFA