[comp.lang.c++] virtual table sizes

bs@alice.UUCP (03/11/87)

I hear that some people have had problems with large amounts of memory
being taken up by vtbls (tables of virtual functions). The reason for
this is that such tables are default replicated (one per .c file that
includes a .h containing a declaration of a class with virtual functions).

There is a simple manual cure for this (lacking a general automatic
solution): the +e option on CC.

	+e1 causes cfront to emit external definitions of vtbls.
	+e0 causes cfront to emit external declarations (only) of vtbls.

The easiest way of using +e is to compile all .c files except one with +e0
and have a file ``classdefs.c'' which simply #include all header files and
compile that one with +e1. main.c is often a good alternative to a separate
classdefs.c.

This optimization can be very worth while for people using an object-oriented
style with lots of virtual functions. The optimization can be noticeable not
only in a.out sizes, but also in link and load times.