Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!milano!cadillac!puma!vaughan From: vaughan@puma.cad.mcc.com (Paul Vaughan) Newsgroups: comp.lang.c++ Subject: class member declarations Message-ID: <8546@cadillac.CAD.MCC.COM> Date: 25 May 90 20:30:11 GMT Sender: news@cadillac.CAD.MCC.COM Lines: 51 A long time back I proposed that declaration capability like the following example be supported: class Foo; void Foo::bar(int); void baz(Foo* f) { f->bar(3); } where to link a program with this fragment, there must exist a class declaration class Foo . . . { public: . . . void bar(int); . . . }; I believe that it could be easily implemented without imposing constraints on the linker, simply by generating and using symbols for the offsets required for generating code with appropriately munged unique and constructable names. However, this does not exist in C++. Now I have an application that routinely does interactive compilation, but which suffers performance difficulties because of the amount of material that must be included whenever I use a class. In particular, I must include the class definitions for not only Foo, but everything in Foo's inheritance graph, and everything in the inheritance graphs of every class of which Foo objects have a member, and so on. Since all the information about a class and transitively related classes, except for the actual code in the function members, must be included for any code module that uses a member of a class, I claim that C++ is EXTRAORDINARILY NON-MODULAR. It's no wonder why people talk about the preprocessed version of a source module being 50 times longer than the code file. Fifty times is conservative--it could be proportional to the size of an entire application compared to the size of an individual code module. There's no way to avoid it. For my application, I'm considering a royal kludge of declaring a lot of non-class-member functions with self munged names to get around this problem. Can you say "DEATH OF OBJECT ORIENTATION?" Paul Vaughan, MCC CAD Program | ARPA: vaughan@mcc.com | Phone: [512] 338-3639 Box 200195, Austin, TX 78720 | UUCP: ...!cs.utexas.edu!milano!cadillac!vaughan