[gnu.g++] Multiple inclusion of virtual tables...

mdt@YAHI.STANFORD.EDU (Michael Tiemann) (03/26/89)

   Path: mit-eddie!ll-xn!ames!lll-winken!uunet!munnari!otc!metro!basser!usage!elecvax!spinifex!malcolmp
   From: malcolmp@spinifex.eecs.unsw.oz (Malcolm Purvis)
   Newsgroups: comp.lang.c++
   Date: 23 Mar 89 01:08:12 GMT
   References: <GRUNWALD.89Mar17220936@flute.cs.uiuc.edu>
   Organization: Kenso Kindi (UNSW)
   Lines: 33
   Apparently-To: lang-c++-netnews-distribution@prep.ai.mit.edu

   [My apologies if this topic has discussed in depth before.]

	   Couldn't you change the compiler to do the equivalent of +e<name>
   automatically so you wouldn't have these problems?  You could put in rules
   that say if when compiling a file it finds a constructor/destructor for a
   class, then the vtbl for that class is defined in this file, otherwise it is
   declared external.  This results in the vtbl being declared in one place
   just as with +e<name>, but you could then name your files however you like,
   and also you wouldn't have to change the Makefile.
Surprisingly enough, on a good day GNU C++ does this automatically.
However, it is very easily defeated by defining the constructors and
destructors in the class definition.

	   Of course the contructor/destructor rule is probably insufficient by
   itself, especially if the class has all inline member functions (inline
   virtual functions? How strange), but you should get the idea.
Why would you think that any other member functions should have any
effect?

	   Malcolm Purvis (malcolmp@{spectrum,spinifex}.eecs.unsw.oz)
		   University of NSW, Sydney, Australia.

   Honours: The students treat you like geniuses, the staff like postgrads, and
   the administration like children........

Michael