[Bug c++/19437] wrong warning when assigning negative value to int
oliverst at online dot de
gcc-bugzilla@gcc.gnu.org
Fri Jan 14 14:26:00 GMT 2005
------- Additional Comments From oliverst at online dot de 2005-01-14 14:26 -------
Ah, OK. Why is there warning at all. "-1" is being assigned to an "int" and not
to an "unsigned int".
Writing it without the "? :" operator, the following code should be the same.
unsigned int i = 0;
int val;
if( i )
val = i;
else
val = -1;
So a warning, that an "unsigned int" is being assigned to an "int" would make
more sense to me. But I don't see how "-1" is being assigned to an "unsigned int".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19437
More information about the Gcc-bugs
mailing list