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

Escape Sequences

In both character constants and string constants, each element in the sequence enclosed by quotes may be an escape sequence of source-set characters that together represent one byte in the constant.

Each escape sequence begins with a backslash. There are simple, octal and hexadecimal escape sequences. The simple sequences are each just a backslash and one character. Octal sequences may continue and hexadecimal sequences must.

Escape Sequence Resolution
\" double quote (0x22)
\' single quote (0x27)
\? question mark (0x3F)
\o where o stands for any digit from 0 to 7 inclusive,
either is or begins an octal escape sequence (see below)
\a alert (0x07)
\b backspace (0x08)
\f form feed (0x0C)
\n new line (0x0A)
\r carriage return (0x0D)
\t tab (0x09)
\v vertical tab (0x0B)
\x begins a hexadecimal escape sequence (see below)
\\ backslash (0x5C)

To follow a backslash with any other character causes a warning (C4129) and the sequence evaluates to the first byte of the invalid character.

An octal escape sequence is a backslash followed by one, two or three consecutive octal digits. The number that these digits form in base 8 becomes the value of the execution-set character that is represented by the escape sequence. It is an error (C2022) if the constant is to be represented in terms of single-byte characters but the number formed by the octal digits is too big to fit in 8 bits. Otherwise, it is an error (C2188) if the number is too big to fit in 16 bits. An octal escape sequence followed by a decimal digit attracts a warning (C4125).

A hexadecimal escape sequence is a backslash followed by a lower-case x and then as many consecutive hexadecimal digits (in upper or lower case) as follow, but at least one. The number that these digits form in base 16 modulo 4G (i.e., truncated to 32 bits) becomes the value of the execution-set character that is represented by the escape sequence. It is an error (C2153) if there is not at least one hexadecimal digit to follow the backslash and x. It is an error (C2022) if the constant is to be represented in terms of single-byte characters but the number formed by the hexadecimal digits is too big to fit in 8 bits. Otherwise, it is an error (C2188) if the number is too big to fit in 16 bits.

Translation Precedence

Given the leading backslash, the remaining characters of the escape sequence are read (and the preceding notes on syntax are to be interpreted) as if trigraphs and line splices are already translated.