Sujet : Re: Representation of _Bool
De : learningcpp1 (at) *nospam* gmail.com (m137)
Groupes : comp.lang.cDate : 17. Jan 2025, 03:47:49
Autres entêtes
Organisation : novaBBS
Message-ID : <42fcea7270de500367eceea7ad5530fd@www.novabbs.com>
References : 1
User-Agent : Rocksolid Light
Hi Keith,
Thank you for posting this. I noticed that the newer drafts of C23
(N2912 onwards, I think) have replaced the term "trap representation"
with "non-value representation":
- **Trap representation** was last defined in [N2731
3.19.4(1)](
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2912.pdf#page=)
as "an object representation that need not represent a value of the
object type."
- **Non-value representation** is most recently defined in [N3435
3.26(1)](
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3435.pdf#page=23)
as "an object representation that does not represent a value of the
object type."
The definition of non-value representation rules out object
representations that represent a value of the object type from being
non-value representations. So it seems to be stricter than the
definition of trap representation, which does not seem to rule out such
object representations from being trap representations. Is this
interpretation correct?
If so, what happens to the 254 trap representations that GCC and Clang
reserve for `_Bool`? Assuming a width of 1, each of those 254 object
representations represents a value in `_Bool`'s domain (the half whose
value bit is 1 represents the value `true`, while the other half whose
value bit is 0 represents the value `false`), so they cannot be thought
of as non-value representations (since a non-value representation must
be an object representation that **does not** represent a value of the
object type).
I've been stuck on this for quite some time, so would be grateful for
any guidance you could provide.
Thank you