On 4/25/16 8:43 PM, will sanfilippo wrote:
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)

You used tabs here - so it shows unaligned in email :-), but I get the point and agree. I don't feel too strongly about '#define' alignment, but am happy to add it, I do it anyway.


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;
}

+1 for this one.


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.

We should add a note: follow the coding standards of the original source is my perspective.

* 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)?


Within reason.  We can still make fun of particularly ugly code. :-)

On macros, what are people's sense? I prefer to have _ALL_ my macros uppercased, but I didn't put that in there. I like to know what is a macro (upper-case), vs what is a function.

Sterling

Reply via email to