On 2013-01-18 08:18, Jonathan M Davis wrote:
In _any_ language. Inevitably, the formatter ends up totally mangling at least
some of the lines. In my experience, any attempt to be super strict with the
formatting rules (as an automatic code formatter must be) results in ugly
code. A basic set of formatting rules helps the code be consistent and look
good, but there are always corner cases where the rules must be bent or broken
in order to make the code appropriately legible. And it requires having a
human do the formatting to get that kind of flexibility.
Eclipse has a pretty darn good code formatter. It formatted the code
exactly like I wanted to, except in one or two cases but that's usually
because I broke my own rules.
Example, this is usually how I format a switch statement:
switch (value)
{
case 1:
// code
break;
case 2:
// code
break;
}
But on occasion, when I have only a short single line expression and
many cases I usually format it like this:
switch (value)
{
case 1: a = 2; break;
case 2: a = 3; break;
case 3: a = 4; break;
}
The formatter will break that.
--
/Jacob Carlborg