title: NULL pointer compatibility with static_cast
body: <p>Q1. Why does using NULL pointers with <code>static_cast</code> cause crashes while <code>dynamic_cast</code> and <code>reinterpret_cast</code> give a NULL pointer in return?</p>
  <p>The problem occurred in a method similar to the one given below:</p>
  <pre><code>void A::SetEntity(B* pEntity, int iMyEntityType)
  {   
      switch (iMyEntityType)
      {   
      case ENTITY1:
          {
              Set1(static_cast&lt;C*&gt;(pEntity));
              return;
          }
      case ENTITY2:
          {
              Set2(static_cast&lt;D*&gt;(pEntity));
              return;
          }
      case ENTITY3:
          {
              Set3(static_cast&lt;E*&gt;(pEntity));
              return;
          }   
      }
  }
  
  Inheritance:
    class X: public B
    class Y: public B
    class Z: public B
  
    class C: public X, public M
    class D: public Y, public M
    class E: public Z, public M
  </code></pre>
  <p>Q2. Is <code>static_casting</code> from B to C/D/E valid? (this worked ok till the input became NULL)</p>
  <p>I'm using gcc version 3.4.3</p>