Re: Patch for definition of NULL



On 11 Jul 2001, Owen Taylor wrote:

> Mark Murnane <Mark Murnane Sun COM> writes:
> 
> > Hi,
> > 
> > When compiling glib with Sun's Forte compiler, we run across problems
> > with the definition of NULL.  On Solaris systems NULL is defined as
> > either 0 or 0L, depending on whether or not you're compiling 64-bit
> > binaries.  I've put a conditional define in gmacros.h which only applied
> > when Forte is being used.  Does anyone have any objections if I commit
> > this?
> 
> I'm tending to thing that the right thing here is to simply include
> stddef.h to get the corrent definition of NULL. Trying to match
> all systems stddef.h with #ifdef's is a rats-nest I'd much
> prefer not to enter.
> 
> Tim has expressed his opposition to this, but I can't agree. If
> someone doesn't want the fundemental basic stuff defined in stddef.h,
> they aren't going to want all the stuff the GLib headers drag in as
> well.

the basic issue here was, that you meant to solve size_t and ssize_t
availability with including stddef.h and that wouldn't work because
stddef.h doesn't define ssize_t everywhere.

including stddef.h is probably reasonable along the same line as the
rationale for including limits.h, it shouldn't come with prototypes
et all on a sane system.
however i fail to recognize why this is a problem on solaris, since
we already special case:

#ifndef NULL
#  ifdef __cplusplus
#    define NULL        (0L)
#  else /* !__cplusplus */
#    define NULL        ((void*) 0)
#  endif /* !__cplusplus */
#endif

what exactly is the setup that gets Sun's Forte compiler to complain,
plain inclusiong of glib.h? or glib.h first, then stddef.h? including
them in the order stddef.h glib.h shouldn't produce any harm whatsoever.

> 
> Regards,
>                                         Owen
> 

---
ciaoTJ






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]