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 16:14:41 +0100
On Friday 09 of January 2015 03:40:45 Timothy Pearson wrote:
> This is the current consensus as far as I can tell:
> 1.) Every conditional uses braces
> 2.) Hard tabs
> 3.) Conditional indentation like so:
>
> if (foo) {
> � � a=0;
> }
> else if (bar) {
> � � a=1;
> }
> else {
> � � a=2;
> }

Incidentally, the 'else' is block like everyone other, so it "should have" 
their own brackets and indentation:

if (foo) {
    a=0;
}
else {
    if (bar) {
        a=1;
    }
    else {
        a=2;
    }
}

I understand that in cases of use strictly as 'elseif' is acceptable to omit 
the brackets. However, only I'm not sure if complicated cases are a source of 
compiler warnings 'ambiguous else'.

-- 
Sl�vek