This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


1539. Definition of “character type”

Section: 6.8.2  [basic.fundamental]     Status: CD3     Submitter: Beman Dawes     Date: 2012-08-15

[Moved to DR at the April, 2013 meeting.]

The term character type is used in the Standard without definition. It should be defined; however, the use of the term is divergent between the core and library clauses: in the former, it means narrow character types, while in the latter it includes wchar_t, char16_t, and char32_t, so care must be taken in ensuring that no inadvertent changes are implied.

Proposed resolution (October, 2012):

  1. Change _N4885_6.7.5.5.4 [basic.stc.dynamic.safety] paragraph 1 as follows:

  2. A traceable pointer object is

  3. Change 6.8.2 [basic.fundamental] paragraph 1 as follows:

  4. Objects declared as characters (char) shall be large enough to store any member of the implementation's basic character set. If a character from this set is stored in a character object, the integral value of that character object is equal to the value of the single character literal form of that character. It is implementation-defined whether a char object can hold negative values. Characters can be explicitly declared unsigned or signed. Plain char, signed char, and unsigned char are three distinct types, collectively called narrow character types. A char, a signed char, and an unsigned char occupy the same amount of storage and have the same alignment requirements (6.7.6 [basic.align]); that is, they have the same object representation. For narrow character types, all bits of the object representation participate in the value representation. For unsigned narrow character types, all possible bit patterns of the value representation represent numbers. These requirements do not hold for other types. In any particular implementation, a plain char object can take on either the same values as a signed char or an unsigned char; which one is implementation-defined.
  5. Change 6.7.6 [basic.align] paragraph 6 as follows:

  6. The alignment requirement of a complete type can be queried using an alignof expression (7.6.2.6 [expr.alignof]). Furthermore, the types char, signed char, and unsigned char narrow character types (6.8.2 [basic.fundamental]) shall have the weakest alignment requirement. [Note: This enables the narrow character types to be used as the underlying type for an aligned memory area (9.12.2 [dcl.align]). —end note]
  7. Change 9.4.3 [dcl.init.string] paragraph 1 as follows:

  8. A char array (whether plain char, signed char, or unsigned char) An array of narrow character type (6.8.2 [basic.fundamental]), char16_t array, char32_t array, or wchar_t array can be initialized by a narrow character string literal, char16_t string literal, char32_t string literal, or wide string literal, respectively, or by an appropriately-typed string literal enclosed in braces (5.13.5 [lex.string]). Successive characters of the value of the string literal initialize the elements of the array. [Example: