[cxx-abi-dev] IA-64 C++ ABI key function question

Jason Merrill jason at redhat.com
Mon Sep 16 12:26:47 UTC 2002


On Mon, 16 Sep 2002 12:30:24 +0100, scott douglass <sdouglass at arm.com> wrote:

> In section 5.2.3 of the IA-64 C++ ABI it is very specific that T::f is
> the key function in the following example:
>
>   struct T {
>     virtual void f();
>     virtual void g();
>   };
>   inline void T::f() { }
>   // no inline definition of T::g
>
> What is the rationale for making T::f the key function?
>
> We find that this sort of usage is fairly common in header files which,
> as the ABI document points out, causes the vtable (and a potential
> cascade of the inline virtual functions) to be emitted in every object
> file.
>
> I'm guessing the idea was to avoid choosing different key functions in
> different translation units because T::f is defined as inline in one
> (like above) but not defined at all in another translation unit.

Yes.

> But this situation is already a violation of 3.2 One Definition Rule
> because "A virtual member function is used if it is not pure." and "An
> inline function shall be defined in every translation unit in which it is
> used.".

Hmm, good point.

Jason



More information about the cxx-abi-dev mailing list