SKETCH OF HOW RESEARCH MIGHT CONTINUE AND RESULTS BE PRESENTED - PREVIEW ONLY

String Constants

Syntax

[prefix]"[s-char-sequence]"

The introductory sequence for a character constant is

However, to have S as the prefix is a fatal error (C1190) unless compiling for managed code (as with the /clr option) with either the /E option active or the System.Object symbol successfully imported as metadata (as from the #using <mscorlib.dll> directive).

The optional s-char-sequence begins immediately after the opening double-quote. It is any number of elements of the following types in any order:

Note however that particular cases exist where escape sequences are not recognised and an s-char is simply any character other than a double-quote or new-line. Most notable are the #import, #include, #pragma include_alias and #using directives, where their arguments are interpreted as specialised string constants.

A double-quote where an s-char or escape-sequence is permitted terminates the s-char-sequence. It is an error (C2001) if the line ends without this closing double-quote.

Each s-char or escape-sequence specifies one character or byte respectively of string data, if prefix is absent, else one wide character. A null character is appended. It is an error (C2026) if this string data gets too long. The present limit is roughly 2048 bytes. (The imprecision applies when the string data is produced as wide characters. Conversion of one or two source-set characters to wide characters is done using space further into the same buffer in which the string data is built. The limit is therefore reached when the string data is a few bytes short of 2048. Exactly how short depends on the mixture of single-byte and double-byte characters as the limit is approached.)

The string constant becomes one token whose value is the string data specified by s-char-sequence, with a terminating null, represented as

Translation Precedence

In general, the characters of a string constant are read (and the preceding notes on syntax are to be interpreted) as if trigraphs and line splices are already translated.

An exception exists, whether by design or oversight. Where the introduction to a string constant has both a prefix and double-quote, the two must be consecutive in the actual input stream. Separation by a trigraph or line splice prevents recognition of prefix as starting a string constant.