<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1539</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="1539"></A><H4>1539.
  
Definition of &#8220;character type&#8221;
</H4>
<B>Section: </B>6.9.2&#160; [<A href="https://wg21.link/basic.fundamental">basic.fundamental</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD3
 &#160;&#160;&#160;

 <B>Submitter: </B>Beman Dawes
 &#160;&#160;&#160;

 <B>Date: </B>2012-08-15<BR>


<P>[Moved to DR at the April, 2013 meeting.]</P>



<P>The term <I>character type</I> 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 <TT>wchar_t</TT>,
<TT>char16_t</TT>, and <TT>char32_t</TT>, so care must be taken in
ensuring that no inadvertent changes are implied.</P>

<P><B>Proposed resolution (October, 2012):</B></P>

<OL>
<LI><P>Change _N4885_6.7.5.5.4 [<A href="https://wg21.link/basic.stc.dynamic.safety#1">basic.stc.dynamic.safety</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

<P>A <I>traceable pointer object</I> is</P>

<UL>
<LI><P>...</P></LI>

<LI><P>a sequence of elements in an array of <INS>narrow</INS>
character type <INS>(6.9.2 [<A href="https://wg21.link/basic.fundamental">basic.fundamental</A>])</INS>, where the size
and alignment of the sequence match those of some object pointer
type.</P></LI>

</UL>

</BLOCKQUOTE>

<LI><P>Change 6.9.2 [<A href="https://wg21.link/basic.fundamental#1">basic.fundamental</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

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
<TT>char</TT> object can hold negative values. Characters can be
explicitly declared <TT>unsigned</TT> or <TT>signed</TT>.  Plain
<TT>char</TT>, <TT>signed char</TT>, and <TT>unsigned char</TT> are
three distinct types<INS>, collectively called <I>narrow character
types</I></INS>.  A <TT>char</TT>, a <TT>signed char</TT>, and an
<TT>unsigned char</TT> occupy the same amount of storage and have the
same alignment requirements (6.8.3 [<A href="https://wg21.link/basic.align">basic.align</A>]); that is, they
have the same object representation. For <INS>narrow</INS> character
types, all bits of the object representation participate in the value
representation. For unsigned <INS>narrow</INS> 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 <TT>char</TT> object can take on either the
same values as a <TT>signed char</TT> or an <TT>unsigned char</TT>;
which one is implementation-defined.

</BLOCKQUOTE>

<LI><P>Change 6.8.3 [<A href="https://wg21.link/basic.align#6">basic.align</A>] paragraph 6 as follows:</P></LI>

<BLOCKQUOTE>

The alignment requirement of a complete type can be queried using an
<TT>alignof</TT> expression (7.6.2.6 [<A href="https://wg21.link/expr.alignof">expr.alignof</A>]).
Furthermore, the <DEL>types <TT>char</TT>, <TT>signed char</TT>, and
<TT>unsigned char</TT></DEL> <INS>narrow character types (6.9.2 [<A href="https://wg21.link/basic.fundamental">basic.fundamental</A>])</INS> shall have the weakest alignment requirement.
[<I>Note:</I> This enables the <INS>narrow</INS> character types to be
used as the underlying type for an aligned memory area (9.13.2 [<A href="https://wg21.link/dcl.align">dcl.align</A>]). &#8212;<I>end note</I>]

</BLOCKQUOTE>

<LI><P>Change 9.5.3 [<A href="https://wg21.link/dcl.init.string#1">dcl.init.string</A>] paragraph 1 as follows:</P></LI>

<BLOCKQUOTE>

<DEL>A <TT>char</TT> array (whether plain <TT>char</TT>, <TT>signed
char</TT>, or <TT>unsigned char</TT>)</DEL> <INS>An array of narrow
character type (6.9.2 [<A href="https://wg21.link/basic.fundamental">basic.fundamental</A>])</INS>, <TT>char16_t
</TT>array, <TT>char32_t</TT> array, or <TT>wchar_t</TT> array can be
initialized by a narrow <DEL>character</DEL> <INS>string</INS>
literal, <TT>char16_t</TT> string literal, <TT>char32_t</TT> string
literal, or wide string literal, respectively, or by an
appropriately-typed string literal enclosed in braces
<INS>(5.13.5 [<A href="https://wg21.link/lex.string">lex.string</A>])</INS>.  Successive characters of
the value of the string literal initialize the elements of the
array. [<I>Example:</I>

</BLOCKQUOTE>

</OL>

<BR><BR>
</BODY>
</HTML>
