Proposed Changes:
* A function prototype in a header file may (or should?) be a single line (i.e.
type and name can be on same line).
* Global variables should be prefaced by g_
Comments:
* I dont see anything here regarding “alignment” of various things. Should we
be adding these to the coding style? For example:
This:
#define PRETTY (0)
#define VERY_PRETTY (1)
#define BEAUTIFUL (2)
Not:
#define UGLY (0)
#define REALLY_UGLY (1)
#define HIDEOUS (2)
— or —
This:
struct my_struct
{
int ms_foo1;
uint16_t ms_foo2;
struct qelem elem;
}
Not:
struct my_struct
{
int ms_foo1;
uint16_t foo2;
struct qelem elem;
}
Questions:
* I presume that outside code not written to this style will not be modified?
For example, another open source project has code that we adopt.
* I presume that if not explicitly stated as “dont do” you can do it. For
example, do all macros have to be uppercase? I can have either MY_MACRO(x) or
my_macro(x)?
> On Apr 24, 2016, at 10:08 AM, Sterling Hughes <[email protected]> wrote:
>
> Hi,
>
> As we start to bring on new contributors, and operate as a project, its
> increasingly important that we document and agree upon coding standards. I
> think we've done a good job of maintaining this consistency informally, but,
> now we need to vote and agree on project standards.
>
> I've taken a first stab at this and committed it to the develop branch, folks
> can see it here:
>
> https://github.com/apache/incubator-mynewt-core/blob/develop/CODING_STANDARDS.md
>
> I think next steps are:
>
> - If you have formatting fixes, or clarifications that don't change the
> contents, just go ahead and edit the document.
>
> - If you disagree with something in the document, or think it should be
> changed in some way, respond back to this thread.
>
> - If you have additions or rules that you don't think were captured, respond
> back to this thread, along with the proposed text. If nobody objects, I'll
> just fold them into whatever other revisions we decide to make.
>
> After we give this a round of discussion, I'll capture all the feedback and
> do a rev of the document. If nobody has any issues with that rev, we can
> vote to officially adopt these coding standards. I personally think this
> should be an up or down vote.
>
> Well - OK, let the conversations begin :-)
>
> Sterling