3 ms·
"There is no need to put braces around the contents of a case block." There is here. In some dialects, you can only declare a variable at the start of a block
by dllthomas 11y ago
"There is no need to put braces around the contents of a case block."
There is here.
In some dialects, you can only declare a variable at the start of a block. From the perspective of the compiler, a "case block" isn't actually a block, just stuff between labels. In order to declare temporary_variable, it may be necessary to put the braces, and it is probably best practice as temporary_variable may otherwise be exposed to later cases (and in C++, a jump over a variable declaration seems to produce an error).