This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/8715] '~' operator for unsigned char and conversion to bool



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]