From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Martin v. Loewis" To: toon@moene.indiv.nluug.nl Cc: andrewm@uow.edu.au, pfeifer@dbai.tuwien.ac.at, meissner@cygnus.com, gcc@gcc.gnu.org Subject: Re: comparisons.. Date: Fri, 14 Jul 2000 14:00:00 -0000 Message-id: <200007142058.WAA01109@loewis.home.cs.tu-berlin.de> References: <396D78FE.C4A91B53@uow.edu.au> <396E5ABD.856EACF4@uow.edu.au> <396EF633.A6FB44AB@moene.indiv.nluug.nl> X-SW-Source: 2000-07/msg00468.html > I always wondered whether it would be possible to drop the warning in > case the signed constant has the same value when interpreted as an > unsigned value. Obviously, it is useful to compare an unsigned variable > against a _positive_ constant, even if it - strictly according to the > rules - should be interpreted as a signed quantity. Or is this a > promotion-hair issue ? The warning is not justified in this case. The integer constant is converted into an unsigned integer, and standard C guarantees that there will be no change in value due to this conversion. So writing x > 5 is guaranteed to be the same thing as x > 5U Regards, Martin