Re: Comparison of promoted ~unsigned
Re: Comparison of promoted ~unsigned
- Subject: Re: Comparison of promoted ~unsigned
- From: Chris Suter <email@hidden>
- Date: Wed, 7 Oct 2009 19:22:39 +1100
Hi Jonny,
On Wed, Oct 7, 2009 at 7:12 PM, Jonny Taylor <email@hidden> wrote:
> What compiler and version are you using? I don't see this extra
> warning on any of the compilers available to me.
>
> I see this with gcc 4.0 and 4.2, both tiger and snow leopard standard
> installs, when I enable -Wall (or -Wsign-compare). Are you saying you see
> neither error, or just the first (probably correct) one?
Just the first.
On SL:
# cat | gcc -c -W -Wall -x c -O3 -arch i386 -o /dev/null -
#include <stdlib.h>
int main (void)
{
unsigned short a = 1;
if (a < ~a)
exit(0);
if (a < (unsigned short)(~a))
exit(0);
return 0;
}
^D
<stdin>: In function ‘main’:
<stdin>:6: warning: comparison of promoted ~unsigned with unsigned
# gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Kind regards,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden