Path: utzoo!mnetor!tmsoft!torsqnt!hybrid!scifi!bywater!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: Problems maintaining header files Message-ID: <70484@microsoft.UUCP> Date: 5 Feb 91 19:00:51 GMT References: <15917@reed.UUCP> <6107@stpstn.UUCP> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 34 In article <6107@stpstn.UUCP> lerman@stpstn.UUCP (Ken Lerman) writes: |In article <15917@reed.UUCP> minar@reed.bitnet (Nelson Minar,L08,x640,7776519) writes: |: |:In C, I barely managed to keep all my header files straight and organized. |:C++ just compounds my problems. | |... | |: |:Are constructs like '#pragma once' just entirely common in C++ headers? I |:find them ugly.. | |Objective-C (please hold the flames down to a dull roar) uses '#import |' to mean the same thing as '#include ' except do |nothing if the file has already been imported. This is MUCH nicer |than '#pragma once' and might be a useful addition to C++. I agree. I think its silly that the most common [and unavoidable] use of the preprocessor requires several lines of code to program. Likewise, one could imagine an: #export "foo.h" .... #endexport directive that [in the simplest implementations] would have the effect of copying the code found in the enclosed section, before macro expansion, to the file "foo.h" Such an export section would allow one write a complete class in one .c file, with the required .h file generated "automatically." Smarter implementations could only generate a new .h section if the .c export section changed, could cache the #export section in memory, ....