A solution to the multiple inclusion problem

Brandon S. Allbery allbery at NCoast.ORG
Thu Oct 26 09:54:32 AEST 1989


As quoted from <14790 at bfmny0.UU.NET> by tneff at bfmny0.UU.NET (Tom Neff):
+---------------
| In article <1659 at atanasoff.cs.iastate.edu> hascall at atanasoff.UUCP (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???
| 
| Including standard HEADER files should be idempotent.  Back here in the
| real world there are plenty of uses for including a file multiple times
| with a desired substantial effect on each inclusion.  Examples include
+---------------

Agreed.  I have simulated packages this way, e.g.

	#define PACKAGE_NAME foo
	#define PACKAGE_TYPE float
	#include "package.h"

++Brandon
-- 
Brandon S. Allbery:  allbery at NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi)
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery at hal.cwru.edu bsa at telotech.uucp
*(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)*
*Third party vote-collection service: send mail to allbery at uunet.uu.net (ONLY)*
>>>	 Shall we try for comp.protocols.tcp-ip.eniac next, Richard?	    <<<



More information about the Comp.lang.c mailing list