[openbeosnetteam] Re: Fix for resolving host names

"Brennan Cleveland" <warriorspot@xxxxxxxxxxxxx> wrote:
> >I would say no.
> >
> >Where is h_errno implemented?
> >
> >It is defined as external to gethostnamadr.c and it is defined as 
> >
> >extern int h_errno;
> >
> >not 
> >extern int * h_errno;
> 
> If this were true the malloc() call wouldn't compile.  h_errno is
> actually #defined in netdb.h (i believe) as a pointer variable...

David is correct.  h_errno is defined as extern int in
gethostnamadr.c.  As such, it's inappropriate to define it with
that malloc.  I suppose the malloc does compile because a
pointer type is also an int.

You're also somewhat correct because the Be version of
h_errno is not int.  It's also not  * int though, at least in netdb.h.
It is defined as a macro, #define'd to a call to a no-argument
function, _h_errnop. This is similar to the definition of errno
in errno.h.

Andrew


Other related posts: