C warning that I can't seem to track down

Tim Writer tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Fri Aug 11 01:04:10 UTC 2006


Mel Wilson <mwilson-4YeSL8/OYKRWk0Htik3J/w at public.gmane.org> writes:

> Mel Wilson wrote:
> > bob wrote:
> >> Still can't believe how obtuse the Linux headers have become since I last
> >> looked in any detail.    Maybe Google can tell me where socklen_t is
> >> actually defined ...
> 
> > :-/
> 
> > unistd.h:# ifndef __socklen_t_defined
> > unistd.h:typedef __socklen_t socklen_t;
> > unistd.h:#  define __socklen_t_defined
> > So there it is, in unistd.h
> 
> > Now if we only knew what __socklen_t was, we'd be set.  Obtuse?
> > yeah, I sort of agree.
> 
> Turns out __socklen_t is defined in /usr/include/bits/types.h
> 
> It's hard to spot because it's defined by a __STD_TYPE statement
> which is a #defined extension to typedef.  It's a __U32_TYPE
> which is a defined stand-in for unsigned int.
> 
> Found this with a little Python thing that scrambles through
> the directory tree finding strings in files.

While this has triggered an interesting discussion about find, grep, and so
on, other than mere curiosity, why do you need to know what a socklen_t is.
The whole point of these types is so that you don't have to worry about
platform dependencies. Just use socklen_t consistently throughout your code
and minimize (or, better still, avoid) conversion to and from other integer
types.

-- 
tim writer <tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org>                                  starnix inc.
647.722.5301                                      toronto, ontario, canada
http://www.starnix.com              professional linux services & products
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list