Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!dlogics!jmd From: jmd@dlogics.COM (Jens M. Dill) Newsgroups: comp.lang.c++ Subject: Re: precompiling header files Message-ID: <617@dlogics.COM> Date: 10 Aug 90 14:05:43 GMT Reply-To: jmd@dlogics.com Organization: Datalogics Inc., Chicago Lines: 24 In article <946@tcs.tcs.com>, gwu@nujoizey.tcs.com (George Wu) writes: > In article <9008080109.AA03748@lem>, tmb@AI.MIT.EDU (Thomas M. Breuel) writes: > |> Currently, if you want a function to be compiled but do not want its > |> source code included into every compilation unit that uses it, you must > |> put a declaration into a header file, and repeat the declaration (as > |> part of the definition) in the implementation part. This redundancy is > |> a source of static errors and requires quite a bit of effort keeping > |> two separate files (or parts of a file) consistent. > > What's wrong with including the header file in the implementation > source as well? Then the compiler will see any inconsistency between > the header and the implementation. What's "wrong" is that what appears in the header file must be a DECLARATION, but what appears in the source file must be a DEFINITION. You still have to maintain two independent copies of the same information (type, storage class, prototype, etc.) An explicit or implicit EXPORT facility that collected declaration information by reading the external definitions in a source file would be a big convenience. *=====* TIME CANNOT BE WASTED *=====* -- Jens M. Dill \ But it can be used for purposes / jmd@dlogics.com \ other than what was intended. / *=============================*