Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Jan 2000 11:37:40 -0700
From:      Warner Losh <imp@village.org>
To:        nate@mt.sri.com (Nate Williams)
Cc:        "Ronald F. Guilmette" <rfg@monkeys.com>, Martin Cracauer <cracauer@cons.org>, mauzi@poli.hu, hackers@FreeBSD.ORG
Subject:   Re: [OFFTOPIC] alt. C compiler 
Message-ID:  <200001051837.LAA68897@harmony.village.org>
In-Reply-To: Your message of "Wed, 05 Jan 2000 11:16:28 MST." <200001051816.LAA20023@mt.sri.com> 
References:  <200001051816.LAA20023@mt.sri.com>  <20000105100716.A63545@cons.org> <98339.947095734@monkeys.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <200001051816.LAA20023@mt.sri.com> Nate Williams writes:
: > [3] The ANSI C standard, at least, contains the requirement that each
: >     individual system include file specified by that standard should
: >     be usable all by itself, without the programmer being required to
: >     explicitly include any OTHER system include files, prior to the one
: >     he/she is actually interested in using.
: 
: Can you quote me chapter and verse for this?  I don't believe this to be
: true, and in truth, I believe this is completely wrong.

I don't think he can.  The only requirements that it has are that some
header files not pull other header files in to define certain things.
NULL can be defined in a number of different places, for example, but
if you include stdlib.h or stddef.h for it, you don't get stdio.h.
This is explained in more detail in section 7.1.1.4 of the August 3,
1998 committee draft:
       7.1.1                      Library                     7.1.2
...
       [#2] The standard headers are

            <assert.h>    <inttypes.h>  <signal.h>    <stdlib.h>
            <complex.h>   <iso646.h>    <stdarg.h>    <string.h>
            <ctype.h>     <limits.h>    <stdbool.h>   <tgmath.h>
            <errno.h>     <locale.h>    <stddef.h>    <time.h>
            <fenv.h>      <math.h>      <stdint.h>    <wchar.h>
            <float.h>     <setjmp.h>    <stdio.h>     <wctype.h>
...
       [#4] Standard headers may be included in any order; each may
       be  included more than once in a given scope, with no effect
       different from being included only  once,  except  that  the
       effect  of including <assert.h> depends on the definition of
       NDEBUG (see 7.2).  [...]
       However, if an identifier is declared
       or   defined  in  more  than  one  header,  the  second  and
       subsequent associated headers  may  be  included  after  the
       initial  reference to the identifier.[...]
...

Notice that these are for the *STANDARD* header files not the *SYSTEM*
header files.  This is much different than having sys/mublefoo.h
depending on sys/types.h being included first.

Warner


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001051837.LAA68897>