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: Tommy Nordgren <email@hidden>
- Date: Wed, 11 Jul 2007 17:30:19 +0200
On 11 jul 2007, at 12.42, Alastair Houghton wrote:
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.
You're probably right. I had expected warnings about missing
prototypes for the case when a header is not included.
It turns out that the warning flag for missing prototypes is disabled
by default in Objective-C based project templates,
and don't appear to do anything in objective C files, even if enabled.
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
-----------------------------------------------------
An astronomer to a colleague:
-I can't understsnad how you can go to the brothel as often as you
do. Not only is it a filthy habit, but it must cost a lot of money too.
-Thats no problem. I've got a big government grant for the study of
black holes.
Tommy Nordgren
email@hidden
_______________________________________________
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