Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 2000-10-19 15:55:54

Here is a response to Jesse Jones' query from Mike Miller (the C++
committee's core language working group chair).

I'll respond to him suggesting that there is in fact a defect; the readers
were "knowledgeable" and yet they reached the opposite conclusion.

Regardless of that, no one else has challenged Mike's answers to the
questions, so I expect his interpretation is what most of the core working
group believes.


>> Boost has a number of template meta-functions used for
>> identifying types.
>> See
>> They include functions like is_standard_signed_integral and
>> is_pointer. However there's some question about how these should work
>> for const types. Section 3.9.1 of the standard says that "there are
>> signed integer types: signed char, short int, int, and long int".
>> 3.9.3 says that these types are cv-unqualified and the cv-qualified
>> versions are distinct types. This seems to mean that const int is not a
>> signed integer type. Is this interpretation correct and is it what the
>> committee intended to say?
>> The pointer case is similar: the first sentence in section 3.9.3 can be
>> read to mean that const pointer types are not pointer types. Is this A

>> interpretation correct?
>This could be said somewhat more clearly in the Standard, but obviously
>these interpretations are not what is intended. The categorization of
>the various types in 3.9.1 is based on the values each can represent,
>which in turn is related to its value representation (3.9p4). 3.9.3p1
>says that "The cv-qualified or cv-unqualified versions of a type... shall
>have the same representation and alignment requirements."
>("Representation" includes both object representation and value
>representation.) This means that the cv-qualified version of a type can
>contain exactly the same set of values as its cv-unqualified version.
>The "int" type is called a signed integral type because its possible
>values are a subset of the signed integers; because "const int" can
>represent exactly the same set of values, it also is a signed integral
>Another way of looking at this is that 3.9.3p1 says that the cv-qualified
>types are "distinct" types, not "unrelated" types, and uses the word
>"version" to describe them. A const char "is-a" char with some
>restrictions on the context in which it can be used, none of which relate
>to its inherent characteristics. 3.9.1p1 should be read as saying that
>there are four fundamental signed integer types, each with three
>(additional) cv-qualified versions.
>I wouldn't object to seeing better phraseology in the next version of
>the Standard here, but I think a "close and careful reading" of the
>existing text is sufficient for a knowledgeable reader to arrive at the
>correct conclusion, i.e., there is no defect.
>-- Mike Miller

Boost list run by bdawes at, gregod at, cpdaniel at, john at