Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!sgi!shinobu!odin!sgihub!dragon!xanadu.wpd.sgi.com!pal From: pal@xanadu.wpd.sgi.com (Anil Pal) Newsgroups: comp.lang.c++ Subject: Re: Need help, missing virtual tables, Sun C++ 2.0 Message-ID: <1991May11.005908.22236@dragon.wpd.sgi.com> Date: 11 May 91 00:59:08 GMT References: <1991May8.224321.12580@cs.utk.edu> <1991May9.173442.5946@dragon.wpd.sgi.com> <1991May10.182759.28323@neon.Stanford.EDU> Sender: news@dragon.wpd.sgi.com (CNews Account) Reply-To: pal@wpd.sgi.com Organization: Silicon Graphics, Inc. Lines: 22 In article <1991May10.182759.28323@neon.Stanford.EDU>, philip@pescadero.stanford.edu (Philip Machanick) writes: |> Consider a class with only inline virtual functions. |> |> When is the translator going to generate the virtual function table for this? |> (Is it going to give up on trying to be optimal in this case and just generate |> it in every file where the header is included?) I believe so. In addition, it will also generate non-inline copies of the virtual functions (since it needs their address to put in the virtual function table). So, I would suggest that virtual functions should not be made inline, since there is little chance that the translator will actually inline them. Note that it would need to be able to bind the virtual function statically in order to inline it (unless one considers some sort of switch statement with inline function bodies). This sort of thing (multiple static copies of virtual function tables and non-inlined "inline" functions) can really increase the size of a program. -- Anil A. Pal, Silicon Graphics, Inc. pal@wpd.sgi.com (415)-335-7279