Re: Mysterious warning (comparison between pointer and integer)
Re: Mysterious warning (comparison between pointer and integer)
- Subject: Re: Mysterious warning (comparison between pointer and integer)
- From: Alastair Houghton <email@hidden>
- Date: Wed, 11 Jul 2007 11:42:46 +0100
On 11 Jul 2007, at 11:34, Tommy Nordgren wrote:
NULL can expand to just a 0 or a (0) or a 0L or a (0L)
with some compiler settings. Replace NULL by the following to
silence the warning:
(char *) NULL
I don't believe that's the problem; zero is a special value (in terms
of this warning anyway), which you can compare against *any* pointer.
i.e. if you do
struct foo;
int bar(void)
{
if ((char *)0x12345678 == 0)
return 0;
if ((struct foo *)0x12345678 != 0)
return 0;
if ((char *)0x12345678 == 1)
return 0;
if ((struct foo *)0x12345678 != 1)
return 0;
return 1;
}
then you'll get
tst.c: In function ‘bar’:
tst.c:9: warning: comparison between pointer and integer
tst.c:11: warning: comparison between pointer and integer
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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