Why base classes can have a zero size?
<p>Basically it is a <em>follow up</em> of <a href="http://stackoverflow.com/questions/3913525/is-there-a-legal-way-to-define-type-with-zero-size-in-c-eom">this question</a>..</p>

<p>When I look into the Standard docs I found this..</p>

<p>In <em>Classes 9.3</em>,</p>

<blockquote>
  <p>Complete objects and member subobjects of class type <strong>shall have nonzero</strong> size.<em>96)</em> ...</p>
</blockquote>

<p>Yeah, true.. But,</p>

<blockquote>
  <p>96)Base class subobjects are <strong>not so constrained</strong>.</p>
</blockquote>

<p>So, when I looked into <a href="http://www2.research.att.com/~bs/bs_faq2.html#sizeof-empty" rel="nofollow">Stroustrup's FAQ</a>, there is an example as</p>

<pre><code>void f(X* p)
    {
        void* p1 = p;
        void* p2 = &amp;p-&gt;a;
        if (p1 == p2) cout &lt;&lt; "nice: good optimizer";
    } 
</code></pre>

<p>My question is I couldn't understand <strong>how it is an optimization</strong> and also <strong>why base classes are allowed to have zero size</strong>?</p>
