I use curly braces with all of my switch case statements in C/Objective-C/C++
I had not, until a few moments ago, considered whether including the break;
statement inside the braces was good or bad practice. I suspect that it doesn't matter, but I figure it is still worth asking.
switch (foo) {
case 1: {
// stuff
break;
}
default: {
break;
}
}
vs
switch (foo) {
case 1: {
// stuff
} break;
default: {
// stuff
} break;
}
Short answer: it doesn't matter.