title: Final clause in C switch statement (possibly using goto)
body: <p>I could use something like javas finally clause in a C switch. Most of my cases has a shared set of functionality that I would like to put a single case. I was thinking of implementing this using goto statements, being well aware of gotos code obfuscation ability, putting the shared case at the bottom of the switch statement still seems a "cleaner" way to do this than partitioning the shared functionality into a seperate function.</p>
  
  <p>Anyway, I have been trying to do it something like this:</p>
  
  <pre><code>switch( x ) {
  case 0:
      printf("Case 0\n");
      goto case 2;
      break;
  case 1:
      printf("Case 1\n");
      goto case 2;
      break;
  case 2:
      printf("Case 2\n");
      break;
  default:
      // do nothing
      break;
  }
  </code></pre>
  
  <p>However, using gcc, this fail with the error</p>
  
  <pre><code>error: expected identifier or ‘*’ before ‘case’
  </code></pre>
  
  <p>Any suggestions on how to make it work? Or possibly a better approach?</p>