|
| From: | Paul D. Smith |
| Subject: | [bug #34608] comparison of unsigned expression < 0 is always false |
| Date: | Sun, 13 Nov 2011 19:51:08 +0000 |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.10 (maverick) Firefox/3.6.23 |
Update of bug #34608 (project make):
Status: None => Not A Bug
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
It turns out that this warning is actually intentional. If you follow this
through you'll see it ends up in an invocation of this macro:
/* Nonzero if the integer type T is signed. */
#define INTEGER_TYPE_SIGNED(t) ((t) -1 < 0)
The idea is to determine whether a type is signed or not, and to do this we
cast a negative number to the type and see if it's still negative (less than
0). If it is then the type is signed; if not, not.
For systems where the type we pass in is actually unsigned (in this case
uintmax_t) you'll get this warning. However the behavior of the program is
exactly what we expect and want.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?34608>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
| [Prev in Thread] | Current Thread | [Next in Thread] |