Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!tcs!nujoizey!gwu From: gwu@nujoizey.Berkeley.EDU (George Wu) Newsgroups: comp.lang.c++ Subject: Re: precompiling header files Message-ID: <959@tcs.tcs.com> Date: 14 Aug 90 19:28:28 GMT References: <617@dlogics.COM> Sender: usenet@tcs.com Reply-To: gwu@nujoizey.Berkeley.EDU (George Wu) Lines: 42 In article <617@dlogics.COM>, jmd@dlogics.COM (Jens M. Dill) writes: |> 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. I was aware of the difference. You can also have the declaration in the source file. |> 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. There may be two copies of the interface definition, but the compiler will automatically check them for consistency. I'm not arguing the "philisophical" merits of an export facility. I am stating that given what features we do have, I do not find such maintenance activity to be of almost no effort, certainly not when compared to the task of converting all the consumers of a library to something that has just changed its interface. George ---- George J Wu | gwu@tcs.com or ucbcad!tcs!gwu Software Engineer | 2121 Allston Way, Berkeley, CA, 94704 Teknekron Communications Systems, Inc.| (415) 649-3752