Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!sri-unix!sri-spam!ames!ptsfa!ihnp4!drutx!druhi!weh
From: weh@druhi.ATT.COM (HopkinsWE)
Newsgroups: comp.lang.c++
Subject: Re: Questions about C++
Message-ID: <2002@druhi.ATT.COM>
Date: Mon, 6-Jul-87 11:26:35 EDT
Article-I.D.: druhi.2002
Posted: Mon Jul  6 11:26:35 1987
Date-Received: Tue, 7-Jul-87 06:18:56 EDT
References: <227@nih-csl.UUCP> <134@otc.OZ>
Distribution: comp
Organization: AT&T, Denver, CO
Lines: 32
Summary: +e option not THAT hard to use

In article <134@otc.OZ>, mikem@otc.OZ (Mike Mowbray) writes:
> In article <227@nih-csl.UUCP>, keith@nih-csl.UUCP (keith gorlen) says:
> > Since using the +e switch is such a pain, I wouldn't recommend this method.
> 
> Agreed.

If one is using virtual member functions in classes which appear in many
different source files, I highly recommend using the +e option to CC
to reduce the size of the object code significantly (the addendum to
the release notes quotes a savings of 25%).

A simple approach to using the +e option is to use +e0 (only include
external reference to virtual table) for all .c files, and compile
the .h files containing the class declarations using +e1 (generate
globally accessible virtual tables). Wherever the .o files containing
the class member functions are included, also include the .o containing
the virtual tables. If they are placed in an archive (``library''), both
will be automatically included by loader if the class is used anywhere.

Thus, all .c files may be treated uniformly (all compiled with +e0 option);
the only added work is to add a general rule for compiling .h files containing
class declarations, a simple task if using make.


				Bill Hopkins
				AT&T
				11900 N. Pecos St.
				Denver, CO 80234
				{allegra|ihnp4}!druhi!weh

P.S. Please note that the .h files will have to be temporarily copied
or linked into a .c file; otherwise the c compiler won't compile it.