C warning that I can't seem to track down
Alex Beamish
talexb-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Aug 8 13:51:54 UTC 2006
On 8/8/06, bob <ican-rZHaEmXdJNJWk0Htik3J/w at public.gmane.org> wrote:
>
> In newer versions of the GCC compiler the block of C code:
>
> int length;
>
> ...
>
> if(getsockname(s, (struct sockaddr *)&sin, &length))
>
> gives a warning below
>
> socketUtils.c:259: warning: pointer targets in passing argument 3 of
> 'getsockname' differ in signedness
Hi Bob,
Google tells me at
http://www.penguin-soft.com/penguin/man/2/getsockname.html?manpath=/man/man2/getsockname.2.inc
that getsockname has the following prototype:
int getsockname(int s , struct sockaddr * name , socklen_t * namelen );
so you need to cast length to a pointer to socklen_t, even if that works out
to an int in the end. Change your line to
if(getsockname(s, (struct sockaddr *)&sin, (socklen_t *)&length))
and re-compile. Let us know how it all works.
I tracked it down to a define called "socklen_t". Damned if I can find
> where that is defined.
Google is your friend. :)
--
Alex Beamish
Toronto, Ontario
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20060808/07d3149d/attachment.html>
More information about the Legacy
mailing list