Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: C++ binary classes (was: typeof() and virtuals and overloading, oh my!) Message-ID: <662@taumet.com> Date: 9 Apr 91 15:38:47 GMT References: <19093@milton.u.washington.edu> <157@devnull.mpd.tandem.com> <162@devnull.mpd.tandem.com> <27FA1D8B.50C3@tct.com> <1317@appli.se> Organization: Taumetric Corporation, San Diego Lines: 30 niklas@appli.se (Niklas Hallqvist) writes: >So, what is required for distribution of binary only C++ classes that are >to be extensible by inheritance and adding virtual functions? Source code |for the constructors? The class definition of course (in source form, but |I believe no (or almost none) C++ compiler supports precompiled headers). |I understand that extending the class with extra data members won't work, |but that's what inheritance are for, isn't it? As I see it, this should |be of little concern to C++ class developpers, since no work worth |protecting should reside in constructors. |... |Another problem is that no constructors |from the original library could be inline expanded in the binary components, |but that is of course easily dealt with as long as you can ensure that an |optimizing compiler won't do that without your knowledge. Have I missed |something important in my reasoning here? Supposing I'm correct, is this |change to the language rules wortwhile? There are still problems. If a class does not have an explicit non-inline null constructor X::X(), copy constructor X::X(X&), and assignment X::operator=(X&), the compiler may have used default inline versions of these in internal library code, which would become invalid if the class definition changed. It is just not a good idea to modify class definitions without recompiling all code which uses those definitions. This probably limits the usefulness of binary-only libraries. -- Steve Clamage, TauMetric Corp, steve@taumet.com