[Xastir-dev] Proposal to change project coding standards: Please vote!

Jason KG4WSV kg4wsv at gmail.com
Wed May 1 09:32:25 PDT 2019


I don't actually contribute here, so feel free to throw this one out.

1) spaces - abstain
2) line up braces vertically
3) include braces when optional

thoughts: I generally prefer 4 spaces, but since the code is as deep as Tom
describes 2 probably make sense. those of you doing the work can decide.

including optional braces not only improves readability (IMO) but it also
reduces the chance of introducing errors (e.g. if you're switching back and
forth between C and the Harbor Freight of programming languages, python.
This has burned computer engineering students who see python before C).

-j



On Wed, May 1, 2019 at 10:33 AM Curt Mills <curt.we7u at 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 at lists.xastir.org
> http://xastir.org/mailman/listinfo/xastir-dev
>


-- 
-Jason
kg4wsv


More information about the Xastir-dev mailing list