trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: January 2015

Re: [trinity-devel] Codebase formatting discussion

From: Slávek Banko <slavek.banko@...>
Date: Sat, 17 Jan 2015 15:56:00 +0100
On Tuesday 13 of January 2015 00:25:15 Timothy Pearson wrote:
> > Forcing parenthesis everywhere can make code more difficult to read
> > sometimes, as in:
> >
> > if ((a == 3) || (b == 5) || (c == 4))
> > vs
> > if (a == 3 || b == 5 || c == 4)
> >
> > So I also favor the "best legibility" rule. Let's restate it as something
> > like "the minimum number of parenthesis that
> > clearly isolate a conditional logic block. Example:
> >
> > Right: if (a == 3 || (b == 5 && d != 20) || c == 4)
> > Wrong: if (a == 3 || b == 5 && d != 20 || c == 4)
>
> The problem with allowing these is that if I need to refactor the code to
> add in a single conditional I need to add parenthesis, which a.) is an
> additional source of error and b.) messes up the difference tracking
> making it hard for other developers to see what the functional change was.
> �I think I'm going to override you on this one and force the parenthesis.
> ;-)

Ok, I understand and accept.

-- 
Sl�vek