In C++ there is an aliasing loophole which allows the object representation of any object to be read or written through some pointers of character type.
Does this apply only to char
and unsigned char
or also to signed char
?
No, the provision does not extend to signed char
.
[basic.lval]
8 If a program attempts to access the stored value of an object through a glvalue of other than one of the following types the behavior is undefined:
- [...]
- a
char
,unsigned char
, orstd::byte
type.
The quote above contains the very last bullet that pertains to aliasing with character types. signed char
is excluded.
Nevertheless, this is also part of the subject CWG Issue 350 deals with, and so may change. Given the direction the issue has taken, the intent is for it to be (eventually, hopefully?) well-defined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With