Preface: This question is not a duplicate of this one:
This question is also not opinion-based. I am not seeking the "best" style. I am not asking what is the "right" thing to do.
What I am asking is how different coding styles indent switch statements, their case labels, and the actual statements.
I'm particularly interested in how a switch statement is indented in
- K&R style
- Linux kernel style
- GNU style
- Java style
My idea is to be able to be consistent in whatever code I am working with, but most indent style examples don't have switch cases. I like consistency, and the idea that what I'm writing doesn't actually match what I'm writing to is tolerable, but untasty.
{}
rule. And: how to indent the{
and}
themselves is in most cases similar to the if/while/for brace pairs. – Endopeptidase