Path: utzoo!mnetor!uunet!husc6!rutgers!bellcore!faline!ulysses!hector!jss
From: jss@hector.UUCP (Jerry Schwarz)
Newsgroups: comp.lang.c
Subject: Re: Making re-#includes harmless--a simple solution?
Message-ID: <3266@ulysses.homer.nj.att.com>
Date: 10 Dec 87 16:28:56 GMT
References: <2000@bloom-beacon.MIT.EDU>
Sender: daemon@ulysses.homer.nj.att.com
Reply-To: jss@hector (Jerry Schwarz)
Organization: AT&T Bell Labs, Murray Hill
Lines: 35
Summary: not as easy as to define as it first appears

In article <2000@bloom-beacon.MIT.EDU> newman@athena.mit.edu (Ron Newman) writes:
>
>Why not change the semantics of "#include" to be:  "if, while
>processing the current .c source file, I have already included this
>file once, then don't include it again"?
>

We have such a cpp here and it has certain advantages.  But the
problem with putting such a rule into the standard is you then have
to define "same file".  Can  be same as "foo.h". Suppose that
because of -I options  and  resolve to the same
file.  Even worse, suppose "d/foo.h" contains a #include of "g.h" is
this the same as "d/g.h".   You can punt and say that it is up to the
implementor (as the committee has done for where to find "foo.h").
But then have you gained much by adding the rule to the standard.

>Is it too late to fix this for ANSI C??

Almost certainly.  I get a sense that many readers of this group do
not understand how far along the ANSI standard is.   The committee
has been working three or four years.  The draft standard is about to
go out for its second public review.  It now takes a two thirds vote
of the committee to make a change. (Some proposals have won
majorities recently but failed because of the 2/3 rule.)  Any
significant change will require another public review process.
Proposals such as the above or "0b", whatever their merits, are just
too late.  If you want a change you probably have to show not
just that your change is a good idea, but that there is a critical flaw
in the way the current standard addresses whatever area you are
concerned with.  Uglyness, while a flaw, will not count as a critical
flaw in this context.  A contradiction in the proposed standard might.

Jerry Schwarz
Bell Labs
Not a member of X3J11