• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mysterious warning (comparison between pointer and integer)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mysterious warning (comparison between pointer and integer)


  • Subject: Mysterious warning (comparison between pointer and integer)
  • From: Stéphane Sudre <email@hidden>
  • Date: Wed, 11 Jul 2007 11:01:50 +0200

I have a warning in an Obj-C file that is quite mysterious to me:

warning: comparison between pointer and integer

Here is the source code:

// struct in6_addr address_;

- (NSString *) stringValue
{
	char tBuffer[128];

if (IN6_IS_ADDR_LINKLOCAL(&address_) || IN6_IS_ADDR_MULTICAST (&address_))
{
address_.__u6_addr.__u6_addr8[3]=0;
}

if (inet_ntop(AF_INET6,&address_,tBuffer,128)!=NULL) // ******* This is where the warning is reported.
{
return [NSString stringWithUTF8String:tBuffer];
}

return nil;
}


Yet according to the man page:

The function inet_ntop() converts an address *src from network format
(usually a struct in_addr or some other binary form, in network byte
order) to presentation format (suitable for external display purposes).
The size argument specifies the size, in bytes, of the buffer *dst.  It
returns NULL

and headers:

const char	*inet_ntop(int, const void *, char *, size_t);


the code looks correct.

I am probably missing something obvious or there's a bug in gcc.


_______________________________________________ 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
  • Follow-Ups:
    • Re: Mysterious warning (comparison between pointer and integer)
      • From: Tommy Nordgren <email@hidden>
    • Re: Mysterious warning (comparison between pointer and integer)
      • From: Alastair Houghton <email@hidden>
    • Re: Mysterious warning (comparison between pointer and integer)
      • From: Tommy Nordgren <email@hidden>
  • Prev by Date: Re: Re[2]: Using a dylib without installing it
  • Next by Date: malformed object, illegal reference
  • Previous by thread: adding new template keywords?
  • Next by thread: Re: Mysterious warning (comparison between pointer and integer)
  • Index(es):
    • Date
    • Thread