IA-64 C++ ABI key function question

scott douglass sdouglass at arm.com
Mon Sep 16 11:30:24 UTC 2002


Hello,

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.  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.".

Am I correct in thinking that key function was defined this way to enable this particular extension to C++?  Is this a common usage?

Is there some other case I'm missing?

Thanks.




More information about the cxx-abi-dev mailing list