[webkit-dev] Resolution on switch statement indentation

Chris Marrin cmarrin at apple.com
Wed Dec 9 07:26:24 PST 2009

I saw another patch get rejected today because of switch statement  
indentation. We discussed this last week, and I saw a lot of support  
for my proposal of indenting case labels from their switch. But the  
discussion did not end in resolution. To summarize, here are the  
options mentioned:

1) Case labels always have the same indentation as their switch  
(today's rule)

2) Case labels always indent 4 spaces in from their switch (my  

3) Case labels indent 2 spaces in from their switch. (Maciej's rule)

I was a little unclear on Maciej's rule. The last part of his rule is  
"In the case where a case label is followed by a block, include the  
open brace on the same line as the case label and indent the matching  
close brace only two spaces (but still 4 spaces for the contained  
statements)". Did he mean that the contained statements would be  
indented 4 spaces from the case label, meaning they would be indented  
6 spaces from the switch? That's the only way the closing brace could  
be indented 2 spaces from the switch and the code indented 4 spaces  
from the brace. If so, I especially dislike this rule because it  
places the entire body of a block at a nonstandard indentation.

Anyway, how do we come to resolution on this?

cmarrin at apple.com

More information about the webkit-dev mailing list