Voting is closed. We ended up with 13 votes. Indentation: 8 spaces got 1 vote 4 spaces got 3 votes 2 spaces got 6 votes Tabs got 1 vote
Brace Alignment: Allman (Vertically lined-up) got 10 votes K&R got 2 votes Mixed got 1 vote Optional Braces: Mixed got one vote Always-use got 12 votes The final results: 2-space indents Vertical brace alignment Always use braces even when optional We're not planning to do this before the next release, but look for the above changes in the source code soon afterwards, plus of course changes to our coding standard docs. On Sun, May 5, 2019 at 10:05 PM Owen DeLong <o...@delong.com> wrote: > 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 <curt.w...@gmail.com> 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 > >> Xastir-dev@lists.xastir.org > >> http://xastir.org/mailman/listinfo/xastir-dev > >> > > _______________________________________________ > > Xastir-dev mailing list > > Xastir-dev@lists.xastir.org > > http://xastir.org/mailman/listinfo/xastir-dev > > _______________________________________________ > Xastir-dev mailing list > Xastir-dev@lists.xastir.org > http://xastir.org/mailman/listinfo/xastir-dev > -- Curt, WE7U http://we7u.wetnet.net http://www.sarguydigital.com _______________________________________________ Xastir-dev mailing list Xastir-dev@lists.xastir.org http://xastir.org/mailman/listinfo/xastir-dev