[webkit-dev] WebKit style for switch statement

Yong Li yong.li.webkit at gmail.com
Wed Jan 20 14:19:52 PST 2010


As everyone may know, current webkit style (at least for most source code)
for a switch statement is like this:

switch (var) {
case valueFirst:
  ...
  break;
...
 case valueLast:
  ...
  break;
default:
  ASSERT_NOT_REACHED()
}

This looks good. But some compilers may give a warning like: "statement is
unreachable". Disabling this warning is a solution. But this warning can
be helpful in some cases.

So, how about changing the webkit style to this?

 switch (var) {
case valueFirst:
  ...
  break;
...
 default:
   ASSERT(var == valueLast);
  ...
  break;
}


-Yong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100120/2eb6eae2/attachment.html>


More information about the webkit-dev mailing list