Previous Table of Contents "New C Standard" commentary
character-constant: ' c-char-sequence ' L' c-char-sequence '
c-char-sequence: c-char c-char-sequence c-char
c-char:any member of the source character set except the single-quote ', backslash \, or new-line character escape-sequence
escape-sequence: simple-escape-sequence octal-escape-sequence hexadecimal-escape-sequence universal-character-name
simple-escape-sequence:one of \' \" \? \\ \a \b \f \n \r \t \v
octal-escape-sequence: \ octal-digit \ octal-digit octal-digit \ octal-digit octal-digit octal-digit
hexadecimal-escape-sequence: \x hexadecimal-digit hexadecimal-escape-sequence hexadecimal-digit
An integer character constant is a sequence of one or more multibyte
characters enclosed in single-quotes, as in
A wide character constant is the same, except prefixed by the letter
869 With a few exceptions detailed later, the elements of the sequence are any members of the source character set;
870 they are mapped in an implementation-defined manner to members of the execution character set.
' \'double quote " \"question mark ? \?backslash \ \\octal character \octal digits hexadecimal character \xhexadecimal digits
873 The octal digits that follow the backslash in an octal escape sequence are taken to be part of the construction of a single character for an integer character constant or of a single wide character for a wide character constant.
874 The numerical value of the octal integer so formed specifies the value of the desired character or wide character.
The hexadecimal digits that follow the backslash and the letter
876 The numerical value of the hexadecimal integer so formed specifies the value of the desired character or wide character.
877 Each octal or hexadecimal escape sequence is the longest sequence of characters that can constitute the escape sequence.
In addition, characters not in the basic character set are
representable by universal character names and certain nongraphic
characters are representable by escape sequences consisting of the
879 65) The semantics of these characters were discussed in 5.2.2.
880 If any other character follows a backslash, the result is not a token and a diagnostic is required.
881 See future language directions (6.11.4).
The value of an octal or hexadecimal escape sequence shall be in the
range of representable values for the type
An integer character constant has type
884 The value of an integer character constant containing a single character that maps to a single-byte execution character is the numerical value of the representation of the mapped character interpreted as an integer.
The value of an integer character constant containing more than one
If an integer character constant contains a single character or
escape sequence, its value is the one that results when an object
A wide character constant has type
The value of a wide character constant containing a single multibyte
character that maps to a member of the extended execution character
set is the wide character corresponding to that multibyte character,
as defined by the
889 The value of a wide character constant containing more than one multibyte character, or containing a multibyte character or escape sequence not represented in the extended execution character set, is implementation-defined.
Consider implementations that use two's-complement representation for
integers and eight bits for objects that have type
Even if eight bits are used for objects that have type
Even if 12 or more bits are used for objects that have type
Created at: 2008-01-30 02:39:42
The text from WG14/N1256 is copyright © ISO
Created at: 2008-01-30 02:39:42 The text from WG14/N1256 is copyright © ISO