To: DJ Delorie CC: djgpp-workers AT delorie DOT com, gcc AT gcc DOT gnu DOT org Subject: Re: GCC headers and DJGPP port References: <200007180918 DOT FAA06988 AT indy DOT delorie DOT com> <200007181913 DOT VAA01170 AT loewis DOT home DOT cs DOT tu-berlin DOT de> <200007191826 DOT OAA08693 AT indy DOT delorie DOT com> <200007200729 DOT JAA01060 AT loewis DOT home DOT cs DOT tu-berlin DOT de> <200007201024 DOT GAA09536 AT indy DOT delorie DOT com> <200007201205 DOT OAA15361 AT loewis DOT home DOT cs DOT tu-berlin DOT de> <200007201437 DOT KAA29757 AT envy DOT delorie DOT com> From: Geoff Keating Date: 21 Jul 2000 11:33:58 -0700 In-Reply-To: DJ Delorie's message of "Thu, 20 Jul 2000 10:37:16 -0400" Message-ID: Lines: 33 X-Mailer: Gnus v5.5/Emacs 20.3 Reply-To: djgpp-workers AT delorie DOT com DJ Delorie writes: > > I don't know what your copy of stdio.h looks like, however, it > > should certainly test whether NULL is defined before defining it. > > It doesn't. It shouldn't have to. ANSI says that stdio.h provides > NULL. I have a philosophical problem with anyone saying "it should > certainly test it" because it means that, at the whim of the gcc team, > we'd need to add yet another test to our standard headers because yet > another symbol was absconded by the gcc headers. Where does it end? > Do we have to wrap every single #define in all the system headers? > Will we have to wrap the function prototypes also? Note that: - size_t is defined by stdio.h and stddef.h and string.h and wchar.h; - NULL is defined by stdio.h and stddef.h and string.h and time.h and wchar.h; - wchar_t is defined by stdlib.h and stddef.h and wchar.h; so you already have to test if NULL is defined before defining it. Actually, the best way to do this is to put this in, say, string.h: /* Get size_t and NULL from . */ #define __need_size_t #define __need_NULL #include and then you don't have to care what the compiler does, your library will work. A similar technique can be used in stdio.h to implement vfprintf without defining va_arg. -- - Geoffrey Keating