Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2000-01-06 08:43:06


> | Basically, for numeric types, I chose the following numeric categories
as
> | suggested by the Standard:
> | unsigned integral
> | signed integral
> | integral (= unsigned integral + signed integral
> | + any integral types without defined 'signedness' (bool, char,
wchar_t))
>
> As this is an entry on the LWG issue list, could you tell me how do
> you deem a type to be signed? Just it is written 'signed foo'?
> This is an important question for 'char'.
>

The signedness of 'char' is implementation-defined. However, 'char' will
not ever be in the unsigned integral or signed integral categories; only the
integral category.

Whenever possible, my categories strictly follow those suggested by the
Standard:
  (3.9.1p2) "There are four signed integer types: 'signed char', 'short
int', 'int', and 'long int'. . ."
  (3.9.1p3) "For each of the signed integer types, there exists a
corresponding (but different) unsigned integer types: 'unsigned char',
'unsigned short int', 'unsigned int', and 'unsigned long int'. . ."
  (3.9.1p7) "Types bool, char, wchar_t, and the signed and unsigned integer
types are collectively called integral types. . ."

Therefore, I have made 'signed char' a signed integral type, 'unsigned char'
an unsigned integral type, and 'char' an integral type that is neither
signed nor unsigned. I claim that this makes sense, even on systems where
'char' is (for example) signed, because 'char' and 'signed char' are still
distinct types (3.9.1p10).

        -Steve

P.S. I just looked at the active issue list, and I don't see anything
relating to the signedness of char.

P.P.S. Question: under C, char may be signed, unsigned, or psuedo-unsigned
(C:ARM 5.1.3). If I read 3.9.1p1 right, then in C++ char may be only signed
or unsigned. Why was this change made?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk