[Bug c++/8715] '~' operator for unsigned char and conversion to bool
rearnsha at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 26 16:46:00 GMT 2007
------- Comment #7 from rearnsha at gcc dot gnu dot org 2007-01-26 16:46 -------
(In reply to comment #6)
> OK. I see now. This seems hard to fix, since it is exposing the current
> implementation of a conversion to bool.
>
No, it's not the 'current implementation', its the way the C and C++ standards
say this has to happen. When arithmetic operators are applied to sub-int sized
operands they are first converted to int (or unsigned int if they can't be
represented in int -- which is only the case when you have a machine where
sizeof(unsigned short) == sizeof(unsigned int), or something similar).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8715
More information about the Gcc-bugs
mailing list