What's the best way to indent a switch?
Most people use this:
Code:
switch(var) {
default:
somefunc();
break;
}
But to me that looks like it's indented twice, sort of like this:
Code:
if(var)
{
somefunc();
}
Some people use this:
Code:
switch(var) {
default:
somefunc();
break;
}
But that looks like it wasn't indented at all.
I like this style (although it looks indented twice, too):
Code:
switch(var) {
default: {
somefunc();
} break;
}
But a book I read suggested that "case 0: {" was illegal. Is it?
Are there any other ways to indent a switch?