Larch/C++ character constants are the same as C++ (single) character constants.
character-constant ::= [L]'char-const-char'char-const-char ::= normal-char | std-esc |"normal-char ::= any character except',",\or a newline std-esc ::=\n//newline LF|\t//horizontal tab HT|\v//vertical tab VT|\b//backspace BS|\r//carriage return CR|\f//form feed FF|\a//alert BEL|\\//backslash \|\?//question mark ?|\'//single quote '|\"//double quote "|\octal-code //octal code o, oo, ooo|\xhex-digit [ hex-digit ] ... //hex code xhh...octal-code ::= octal-digit | octal-digit octal-digit | octal-digit octal-digit octal-digit
For example, 'l', '\t', and '\032'
are character constants.
The sort of a single character constant is char.
The meaning of a character constant such as 'a'
is not uniquely defined by C++
but depends on "the machine's character set"
(section 2.5.2 [Ellis-Stroustrup90]).
Therefore in Larch/C++, 'a', has sort char,
but its numerical value is not uniquely defined.
A constant that starts with L, for example L'a',
is a wide character constant of sort wchar_t.
Larch/C++ does not support multicharacter constants,
as they are not well-defined.
(See Section 2.5.2 of [Ellis-Stroustrup90]
for a description of multicharacter constants.)
Larch/C++ supports the standard C++ escape sequences. The meaning of such a std-esc is as in C++. In an escape sequence, the octal (or hexadecimal) digit string ends with the first character that is not an octal-digit (or a hex-digit) (see Section 2.5.2 of [Ellis-Stroustrup90]).
Go to the first, previous, next, last section, table of contents.