A solution to the multiple inclusion problem

Tom Neff tneff at bfmny0.UU.NET
Tue Oct 24 15:29:32 AEST 1989


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???
>    (at least for the "standard" includes)

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
program generated data tables, copyright strings, and machine dependent
code sequences.  Any compiler that unconditionally ignored an include file
on the second mention would be horribly broken.
-- 
"My God, Thiokol, when do you      \\    Tom Neff
want me to launch?  Next April?"   \\    tneff at bfmny0.UU.NET



More information about the Comp.lang.c mailing list