Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!portal!cup.portal.com!John_-_Nagle From: John_-_Nagle@cup.portal.com Newsgroups: comp.lang.c++ Subject: Re: #pragma once (was Re: A solution to the multiple inclusion Message-ID: <23464@cup.portal.com> Date: 28 Oct 89 20:41:44 GMT References: <14240@well.UUCP> <2082@plx.UUCP> <1989Oct27.163755.12976@paris.ics.uci.edu> Organization: The Portal System (TM) Lines: 34 While there appears to be an ANSI requirement that source text bypassed due to preprocessor commands be tokenized and error messages generated when appropriate, there's no reason for this to happen more than once per include file. So objections based on that rule are spurious. The "#pragma once" approach is a good idea. But a pragma represents an explicitly nonstandard approach. This should be standardized. Common LISP has "require", which has the right semantics for this situation. Perhaps we could use that keyword. It's worth considering that this new feature be added to C++ only, not C, which is more firmly standardized. In C++, dependencies tend to be more complex than in C, and a larger percentage of the content of the program tends to reside in include files in C++, since most class definitions are in include files. So how about #require FILENAME as the one-time inclusion mechanism for C++. The ultimate goal is that all include files contain "require" statements for everything they need, so that order of inclusion in the ".c" files isn't an issue and the user of a library doesn't have to worry about including too little or too much. Worth noting is that the basic concept of "make" doesn't really handle well the use of include in include files. Something needs to be done about this. John Nagle