[comp.lang.c++] Virtual Function Optimization

dspoon@fenix.Atlanta.NCR.COM (David B. Witherspoon) (09/24/88)

I attempted to respond to Greg Bollella through the mail, but it got
bounced.  I'm posting the response here instead.


In article <4275@thorin.cs.unc.edu> you write:
>
>I have heard about an option '+e' used in the C++ compilation
>with CFront that is supposed to somehow allow the optimization
>of the virtual function table.  I cannot find it documented
>anywhere.  Could someone shed some light?  
>
>Thanks
>
>Greg Bollella

Since I'm not using C++ on UNIX, I don't know first-hand.  But I trust
the info I got:  Without the "+e" option, every time you #include a ".h"
file containing a class definition in a ".c++" file, a new copy the
v-table is created.  Like so:

	y.h
       -----
       a.c  #include's  y.h  --->  v-tab
       b.c  #include's  y.h  --->  v-tab
       [etc]

Using the "+e" option results in just ONE v-table being created (and
extern'ed appropriately) like so:


	y.h
       -----
       a.c  #include's  y.h  -\ 
       b.c  #include's  y.h  --->  v-tab
       c.c  #include's  y.h  -/

Hope that helps.  I like pictures...as you can tell.

[I can't claim this as my own...credit to Bruce Frederiksen at NCR,]
[SE-Retail, in Dayton, OH.                                         ]
-------------------------------David Witherspoon-------------------------------
D.Witherspoon@Atlanta.NCR.COM         | "It's all just 1's and 0's you know!"
NCR Sys Engineering-Retail/Atlanta    | 
MY OPINIONS...ALL MINE!!!             |                         - me