title: What are those two long in vtable assembly code emitted by GCC?
body: <p>I checked the assembly code generated by GCC for following C++ code snippet.</p>
  
  <pre><code>class Interface {
  public:
   virtual int f() = 0;
   virtual int g() = 0;
  };
  
  class Concrete : public Interface {
  public:
   virtual int f();
   virtual int g();
  };
  </code></pre>
  
  <p>Seams there is two long in each vtable, and the assembly code seams doesn't use it, so what is the purpose of those two viable?</p>
  
  <pre><code>          .globl __ZTV8Concrete
            .const_data
            .align 3
    __ZTV8Concrete:
            .long   0   &lt;&lt;&lt;&lt; THOS TWO LONG DOESN"T USED.
            .long   0 
            .long   __ZN8Concrete1gEv
            .long   __ZN8Concrete1fEv
            .globl __ZTV9Interface
            .weak_definition __ZTV9Interface
            .section __DATA,__const_coal,coalesced
            .align 3
    __ZTV9Interface:
            .long   0    &lt;&lt;&lt;&lt; THOS TWO LONG DOESN"T USED ALSO.
            .long   0 
            .long   ___cxa_pure_virtual
            .long   ___cxa_pure_virtual
            .section __TEXT,__textcoal_nt,coalesced,pure_instructions
            .weak_definition        ___x86.get_pc_thunk.cx
            .private_extern ___x86.get_pc_thunk.
  </code></pre>
  
  <p>The constructor:</p>
  
  <pre><code>  __ZN8ConcreteC1Ev:
    LFB8:
            pushl   %ebp
    LCFI9:
            movl    %esp, %ebp
    LCFI10:
            pushl   %ebx
            subl    $20, %esp
    LCFI11:
            call    ___x86.get_pc_thunk.bx
    L2$pb:
            movl    8(%ebp), %eax
            movl    %eax, (%esp)
            call    __ZN9InterfaceC2Ev
            movl    8(%ebp), %edx
  2&gt;        leal    __ZTV8Concrete-L2$pb(%ebx), %eax
            leal    8(%eax), %eax    &lt;&lt;&lt;&lt; SKIP THE TWO 2 LONG for VTABLE
            movl    %eax, (%edx)
            addl    $20, %esp
            popl    %ebx
  </code></pre>