1.      I support 2 character indents spaces only
        I read and write lots of C and C++ with 2 character indents and find it 
to not be a problem,
        especially it is more helpful in deep nesting. Just my $0.02
2.      I support proposed vertical brace alignment.
3.      I propose the following alternative:
        A statement which fits on one line can have optional braces omitted…
                (e.g. if(foo) x=y;)
        A statement which does not fit on one line should have braces even if 
not
        required…
                (e.g.
                        if(foo==bar && baz(blat) != foo && 
longconditionfunction(blah)==0)
                        {
                                x=y;
                        }
                )
4.      This is a good idea even if it isn’t a compiler warning.

Owen

> On Wed, May 1, 2019 at 10:33 AM Curt Mills <[email protected]> wrote:
> 

>> We've been talking in another thread about changing the project coding
>> standards, specifically the number of columns to indent and the bracing
>> standard.
>> 
>> Our two relevant Wiki pages are:
>> http://xastir.org/index.php/HowTo:Contributing
>> and
>> http://xastir.org/index.php/HowTo:Developer_Guidelines_and_Notes
>> 
>> 
>> 1) Indents: I originally proposed that we go from 4-column indents to
>> 2-character indents (Spaces-only, no tab characters unless required for a
>> specific tool). I'm going to back-peddle after reading a bunch of stuff on
>> the 'net: People say 4-char indent for C and C++ makes it more readable.
>> 
>> ***** Please vote on number of chars per indent. *****
>> 
>> 
>> 2) Bracing alignment: I prefer lining up the braces vertically which I find
>> shows the structure of the code much better.
>> 
>> We currently use:
>> 
>>    if (true) {
>>        do something;
>>    else {
>>        do something else;
>>    }
>> 
>> I'm proposing:
>> 
>>    if (true)
>>    {
>>        do something;
>>    }
>>    else
>>    {
>>        do something else;
>>    }
>> 
>> ***** Please vote whether to line up the braces. *****
>> 
>> 
>> 3) Optional bracing: I prefer to include braces when they're optional to
>> improve readability. An example case: An "if" statement with one statement
>> in the "true" block can be written as:
>> 
>>    if (true)
>>        do something;
>> 
>> -or-
>> 
>>    if (true)
>>    {
>>      do something;
>>    }
>> 
>> I prefer the latter. It's not always immediately obvious what you're doing
>> without the braces, particularly when there isn't an "else" clause and/or
>> indenting gets messed up.
>> 
>> ***** Please vote whether to include braces when optional. *****
>> 
>> 
>> 4) One new thing we need (At least with newer compilers) is a comment where
>> a case statement drops through to the next case statement. This example is
>> from db.c:
>> 
>>            case 'O':
>>                symbol.aprs_type = '\\';
>>                /* Falls through. */
>> 
>>            case 'B':
>> 
>> Without that "Falls through" comment we get a compiler warning, so please
>> add that from now on. This item does not require a vote. I already fixed
>> the sources where we needed it.
>> 
>> We could specify a whole bunch of other stuff but the rest isn't all that
>> important.
>> 
>> My votes:
>> 1) 4-char spaces-only
>> 2) Line up braces vertically
>> 3) Include braces when optional
>> 
>> --
>> Curt, WE7U        http://we7u.wetnet.net
>> http://www.sarguydigital.com
>> _______________________________________________
>> Xastir-dev mailing list
>> [email protected]
>> http://xastir.org/mailman/listinfo/xastir-dev
>> 
> _______________________________________________
> Xastir-dev mailing list
> [email protected]
> http://xastir.org/mailman/listinfo/xastir-dev

_______________________________________________
Xastir-dev mailing list
[email protected]
http://xastir.org/mailman/listinfo/xastir-dev

Reply via email to