 <p><strong>C++</strong>:</p> <p>Sometimes you need to introduce an extra brace level of scope to reuse variable names when it makes sense to do so:</p> <pre><code>switch (x) { case 0: int i = 0; foo(i); break; case 1: int i = 1; bar(i); break; } </code></pre> <p>The code above doesn't compile. You need to make it:</p> <pre><code>switch (x) { case 0: { int i = 0; foo(i); } break; case 1: { int i = 1; bar(i); } break; } </code></pre>