Title
Definition of “character type”
Status
cd3
Section
6.8.2 [basic.fundamental]
Submitter
Beman Dawes

Created on 2012-08-15.00:00:00 last changed 131 months ago

Messages

Date: 2013-04-15.00:00:00

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

Date: 2012-10-15.00:00:00

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

    • ...

    • a sequence of elements in an array of narrow character type (6.8.2 [basic.fundamental]), where the size and alignment of the sequence match those of some object pointer type.

  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.3 [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.3 [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:
Date: 2012-08-15.00:00:00

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.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4375
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetmessages: + msg4046
2012-11-03 00:00:00adminsetstatus: open -> ready
2012-08-15 00:00:00admincreate