[webkit-dev] Switch statement indentation

Alexey Proskuryakov ap at webkit.org
Wed Dec 2 16:50:19 PST 2009


On 02.12.2009, at 15:25, Chris Marrin wrote:

> Maybe we could change the style rule in the interest of changing  
> fewer files (and because I think it generally reads better)?


I support changing or dropping this rule. Because of this rule, there  
is no good way to format cases that need braces, such as:

  switch (i) {
  case 1: {
      String a("a");
      break;
  }
  case 2: {
      String b("b");
      break;
  }
  }

The downside is that some code can get indented too far, which is  
particularly unfortunate for large switches. But I'm not convinced  
that having a standard for this improves consistency of the code in  
any meaningful way (*), perhaps this should be decided on a case by  
case basis.

(*) meaningful == helps to read the code, or to search, or to process  
with scripts, or maybe even to copy/paste.

- WBR, Alexey Proskuryakov



More information about the webkit-dev mailing list