000428.2 B X R. Brender Representation Add DW_ATE_wchar_t

Proposal: Add DW_ATE_wchar_t per ISO C++

Current Specification
---------------------

Not mentioned or addressed.

Proposed Modifications to the Document
--------------------------------------

Page 37, Sec 5.1 Base Type Entries

Add in Figure 10:

DW_ATE_wchar_t C++ wide character type

Immediately following Figure 10, add italicized text as in:

<i>The DW_ATE_wchar_t base type is included specifically
for C++ which defines type wchar_t as a "distinct" and "fundamental"
type (unlike C and C99 where wchar_t is "an integer type" defined in
stddef.h, presumably by a typedef).</i>


Page 75, Figure 24

Add
DW_ATE_wchar_t 0x0a


Discussion
----------

The introduction to DWARF V2 section 5.1 is

<i>A base type is a data tyupe that is not defined in terms of other
data types. Each programming language has a set of base types that are
considered to be built into that language.</i>

wchar_t is such a type for C++ (but not for C). So much so that it is
even a keyword (just like int) in C++, (but not for C).

--------------------------------------------------------------------------------
>From ISO/IEC FDIS 14882:1998

2.11 - Keywords
...
-1- The identifiers shown in Table ?? are reserved for use as keywords...
...
[In the table is listed wchar_t...]

3.9.1 - Fundamental types
...
-5- Type wchar_t is a distinct type whose values can represent distinct codes
for all members of the largest extended character set specified among the
supported locales (lib.locale). Type wchar_t shall have the same size,
signedness, and alignment requirements (basic.types) as one of the other
integral types, called its underlying type.
...
-7- Types bool, char, wchar_t, and the signed and unsigned integer types are
collectively called integral types.*
...

4.2 - Array-to-pointer conversion [conv.array]
...
-2- A string literal (lex.string) that is not a wide string literal can be
converted to an rvalue of type ``pointer to char''; a wide string literal can
be converted to an rvalue of type ``pointer to wchar_t''. In either case, the
result is a pointer to the first element of the array...
...

4.5 - Integral promotions [conv.prom]
...
-2- An rvalue of type wchar_t (basic.fundamental) or an enumeration type
(dcl.enum) can be converted to an rvalue of the first of the following types
that can represent all the values of its underlying type: int, unsigned int,
long, or unsigned long.
...

5.3.3 - Sizeof [expr.sizeof]
...
...[Note: in particular, sizeof(bool) and sizeof(wchar_t) are implementation-
defined.]...
...


This proposal was to use wchar_t to describe wide character types in C++.  It was determined that this was not necessary, that describing a wide char as a DW_ATE_(un)signed_char with size of two or four as appropriate.  (There was a confusion between Dwarf 2 base types, which are abstract descriptions of types, and C/C++ types which are described by the base types. wchar_t, int, and char are target language types which are described by the Dwarf 2 base types.) Withdrawn.