Re: INADDR_NONE' undeclared in Squid 1.0.17

From: Markus Gyger <mgyger@dont-contact.us>
Date: Fri, 27 Sep 1996 21:24:12 +0200 (MESZ)

> > + #ifndef INADDR_NONE
> > + #define INADDR_NONE ((unsigned long) -1)
> > + #endif
>
> It would be better to define INADDR_NONE as 0xFFFFFFFF because otherwise it
> doesn't work on non-32 bit architectures (actually on architectures where
> a long is not 32 bits).

It should probably be ((in_addr_t) -1) since the type may be
unsigned long (e.g. HP-UX) or unsigned int (e.g. Digital UNIX).
But even on HP-UX 10.10 you have to define _XOPEN_SOURCE_EXTENDED
to get in_addr_t defined. Maybe 0xFFFFFFFFu would do the job
(at least keep the compiler from complaining about having a negative
signed int constant expressed by a positive value on 32 bit systems),
or else inet_addr("255.255.255.255").

BTW: On HP-UX 10.10 there is in netinet/in.h:

#ifdef _XOPEN_SOURCE_EXTENDED

#ifndef _IN_ADDR_T
#define _IN_ADDR_T
typedef unsigned long in_addr_t;
#endif /* ! _IN_ADDR_T */

#endif /* _XOPEN_SOURCE_EXTENDED */

Regards,
    Markus
Received on Fri Sep 27 1996 - 12:25:17 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:33:05 MST