Spiros said:
The requirement "for every bit pattern which is not a trap
representation" is one that you add yourself and does not appear
in the standard.
No, that's not a requirement, and I had not intended to imply that it
is one. It is a description of the bit patterns that justify
concluding that the requirement has been met; the description itself
is not part of the requirement.
So according to your opinion, if for example all bits 0
represents the value 0 for both an unsigned and signed type then
the requirement "Each bit that is a value bit shall have the
same value as the same bit in the object representation of the
corresponding unsigned type" is met, yes?
If that were the only applicable requirement, yes. However, it's only
a meaningful requirement when you consider bit patterns where the bits
are actually set, and the standard does require the existence of such
bit patterns. The standard defines the meaning of the *_MAX and *_MIN
macros, and imposes minimum values for those which are positive, and
maximum values for those which are negative. This implies that
requirement you're referring to must hold true for all of those
values, not just 0, and for all the bits that need to be non-zero in
order to represent one or more of those values. However, it's not
required to apply for values greater than INT_MAX, and the standard is
not as strict in it's requirements for the ranges of signed integer
types as it for the ranges of unsigned types.
By "statement" I assume you mean the one which says
If there are N value bits, each bit shall represent a
different power of 2 between 1 and 2**(N-1) , so that
objects of that type shall be capable of representing
values from 0 to 2**N - 1 using a pure binary
representation; this shall be known as the value
representation.
No it's not redundant because even if you know the value of each
individual bit, you still don't know how you are supposed to
combine the individual values together to get the value of the
representation. The above statement tells you essentially that
you add together the values of individual bits to get the value
of the representation. If you're saying that it is redundant to
explicitly mention "2**N - 1"
No, I'm saying that it would be redundant if your interpretation were
correct, which I deny. It needs to be said precisely because it is not
redundant, because it implies that all possible combinations of bit
patterns must actually represent valid values, something which is not
otherwise deducible, and which is therefore not required for signed
integer types.
... then perhaps it is but note that
the same "redundancy" exists in footnote 40. And in any case, if
the standard is not shy about repeating itself as you say below,
then I don't think you can draw any conclusions by its choice to
mention something as short as "2**N - 1".
I'm drawing conclusions from it's failure to contain a similar
statement for signed integers.
....
corresponding unsigned type". Looks enough to me. If the
standard is not shy about repeating itself then I wouldn't
expect it to be shy about mentioning for the first time a fairly
important piece of information namely that even in the absence
of padding bits and even if the sign bit is 0 it is still
possible to have trap representations.
It doesn't need to say that; it's already been said when the concept
of trap representations were introduced. In the absence of a statement
to the contrary, the fact that trap representations are permitted to
exist implies that they can include value, sign, and padding bits.
....
Pretty much every part of the standard can be written in various
ways. You seem to be saying that just because this part of the
standard could be written in some other way which you find
"better" then there must be some hidden meaning.
No, I don't consider that there must be some hidden meaning. It seems
to me a quite open and obvious one. One clause, specifically
restricted to unsigned integer types, imposes a requirement. One
clause, specifically restricted to signed integer types, imposes no
such requirement. I don't see anything hidden about that - the
conclusion that the requirement applies only to unsigned integer types
seems quite natural to me. What would have to count as "hidden" is the
"inheritance" of this requirement by signed integer types.
If you see a sign in an airport which says "Incoming passengers who
are not US citizens: use gates 1-4. You will have to pass through
Customs before you are allowed to leave the airport. Incoming
passengers who are US citizens: use gates 5-8." Would you conclude
that US citizens would have to go through Customs? That seems to me to
be implications of the "logic" you're using.