title: Why can't variables be declared in a switch statement?
body: <p>I've always wondered this - why can't you declare variables after a case label in a switch statement?  In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:</p>
  
  <pre><code>switch (val)  
  {  
  case VAL:  
    // This won't work
    int newVal = 42;  
    break;
  case ANOTHER_VAL:  
    ...
    break;
  }  
  </code></pre>
  
  <p>The above gives me the following error (MSC):</p>
  
  <blockquote>
    <p>initialization of 'newVal' is skipped by 'case' label</p>
  </blockquote>
  
  <p>This seems to be a limitation in other languages too.  Why is this such a problem?</p>