delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/03/08/03:10:16

From: Martin Stromberg <Martin DOT Stromberg AT lu DOT erisoft DOT se>
Message-Id: <200003080806.JAA17092@mars.lu.erisoft.se>
Subject: Re: iso646.h and some questions
To: djgpp-workers AT delorie DOT com
Date: Wed, 8 Mar 2000 09:06:13 +0100 (MET)
In-Reply-To: <Pine.LNX.4.10.10003061514590.14313-100000@acp3bf> from "Hans-Bernhard Broeker" at Mar 06, 2000 03:35:30 PM
X-Mailer: ELM [version 2.5 PL3]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 
> On Mon, 6 Mar 2000, Martin Stromberg wrote:
> 
> > > > No. The standard says NULL is defined in wchar.h and in stddef.h.
> > > 
> > > Yes but it does not say, it should be a specific macro, it just mean
> > > that if one #include <wchar.h>  they can use NULL because it will be defined
> > > Most <wchar.h> will just #include <stddef.h> to pull the relevant macros.
> > 
> > But for inttypes.h it explicitly says that inttypes.h #includes
> > stdint.h. So I get the impression that files shouldn't #include each
> > other unless it is stated. 
> 
> In the actual standard, it's even quite a bit stronger than that: none of
> the standard headers is *allowed* to just #include any of the others.
> They're supposed to be choosable 100% independantly. 
> 
> The new version may have some exceptions to this rule given explicitly,
> but the general rule from old ANSI/ISO C89 still holds unchanged, in C99
> (according to the last draft I grabbed):
> 
> Section 7.1.3, "Reserved identifiers"
> 
>         -- Each  identifier  with  file scope listed in any of the
>             following  subclauses  (including  the  future  library
>             directions)  is  reserved  for  use  as macro and as an
>             identifier with file scope in the same  name  space  if
>             any of its associated headers is included.
> 
>        [#2]  No  other  identifiers  are  reserved.  If the program

This passage is in the standard exactly as quoted here.

> These two together mean that unless a program #include's a particular
> header, none of the functions, types and macros it declares are allowed to
> be predefined by the library. They must remain free for the program's own
> use. If <wchar.h> #include'd <stddef.h>, e.g., the program would lose its
> ability to define a type 'size_t' or 'ptrdiff_t'.
> 
> The reason for this is simple: without this mutual independence, the whole
> point of having standard header files would be moot: the C Preprocessor
> would just include all of them, by force, and no programmer would have
> to 'waste his time' typing #include <stdio.h>.

So what do we do about NULL, that should be in both wchar.h and
stddef.h?


Right,

							MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019