A solution to the multiple inclusion problem

Michael Meissner meissner at dg-rtp.dg.com
Wed Oct 25 00:05:03 AEST 1989


In article <1659 at atanasoff.cs.iastate.edu>
hascall at atanasoff.cs.iastate.edu (John Hascall) writes:

>      Since the impending ANSI standard requires that including a file more
>      than once have exactly the same effect as including it once...why can't
>      a compiler just ignore #includes for files it has already #included???
>      (at least for the "standard" includes)
>      
>      Any comments from the ANSI mavens?

Only the include files specified by standard (stdio.h, string.h, etc.)
are required to work when included multiple times (ie, there must be
some sort of guard around parts that can not be redeclared, like
typedefs and structures).  No such requirement is mandated for any
other include file.
--

Michael Meissner, Data General.				If compiles where much
Uucp:		...!mcnc!rti!xyzzy!meissner		faster, when would we
Internet:	meissner at dg-rtp.DG.COM			have time for netnews?



More information about the Comp.lang.c mailing list