Re: Patch for definition of NULL



Owen Taylor <otaylor redhat com> writes:
> Mark Murnane <Mark Murnane Sun COM> writes:
>> 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.

I think glib.h should be able to use at least those headers listed as
required for an ISO C 90 conforming freestanding implementation.  We
depend on other ISO C features, anyway.  According to the GCC
manual[1]

  ... a conforming freestanding implementation is only required to
  provide  certain library facilities: those in <float.h>, <limits.h>,
  <stdarg.h>, and <stddef.h>; since AMD1, also those in <iso646.h>;
  and in C99, also those in <stdbool.h> and <stdint.h>

glib.h includes <float.h>, <limits.h>, and <stdarg.h>.  So, why not
<stddef.h>, which is just as useful?  At worst, we can include it in
<glibconfig.h> when the former exists, or define NULL to 0 otherwise.

- Hari

[1] I know the GCC manual is not canon, but I don't have ISO C 90 or
ANSI C 89 handy, not even the Herb Schildt bastardized version :-)
-- 
Raja R Harinath ------------------------------ harinath cs umn edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash




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