A solution to the multiple inclusion problem

Jacob Gore jacob at gore.com
Wed Oct 25 04:14:07 AEST 1989


/ comp.lang.c / mgordon at lotus.com (PCSD Mac) / Oct 24, 1989 /
How about a new preprocessor directive that means "include this file only 
if it hasn't already been included", say "#require"?  The "preprocessor"
would simply keep a table of files that have already been included and use 
it to avoid including the same #required file more than once.  There will 
always be files you really do want to #include multiple times, so you can't
change the meaning of #include.
----------

Objective-C uses "#import" for just this.  It's very convenient.  (And
portable to all Objective-C implementations:-)

Jacob
--
Jacob Gore		Jacob at Gore.Com			boulder!gore!jacob



More information about the Comp.lang.c mailing list