A solution to the multiple inclusion problem
Glenn Fowler[drew]
gsf at ulysses.homer.nj.att.com
Wed Oct 25 14:10:13 AEST 1989
In article <470005 at gore.com>, jacob at gore.com (Jacob Gore) writes:
>> / 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
>
> Objective-C uses "#import" for just this. It's very convenient. (And
> portable to all Objective-C implementations:-)
the file equivalence relation may be hard to define, e.g., for unix, given
ln x.h y.h
will #require "y.h" include y.h following #include "x.h"?
are "y.h" and "./y.h" the same file?
are "y.h" and "/home/gsf/news/y.h" the same file?
will #require "stdio.h" include stdio.h after #include <stdio.h>?
the various #include "..." implementations further cloud the issue
--
Glenn Fowler (201)-582-2195 AT&T Bell Laboratories, Murray Hill, NJ
uucp: {att,decvax,ucbvax}!ulysses!gsf internet: gsf at ulysses.att.com
More information about the Comp.lang.c
mailing list