[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

codingstyle?



After multiple proddings by Martin Sjögren, I've finally gotten around
to writing down at least something which can become a coding style wrt
bracing, tabs/notabs and such.

This is not a final version.  This is what I'd like to see.

no tabs.  spaces.  four spaces.
opening braces on opening line
closing braces unindented to the correct level

like:

        if (x is true) {
                we do y
        }

and as in CodingStyle from the kernel:

Note that the closing brace is empty on a line of its own, _except_ in
the cases where it is followed by a continuation of the same statement,
ie a "while" in a do-statement or an "else" in an if-statement, like
this:

        do {
                body of do-loop
        } while (condition);

and

        if (x == y) {
                ..
        } else if (x > y) {
                ...
        } else {
                ....
        }
                        
Rationale: K&R. 

Name stuff sanely.  Try to stay away from globals.

(yes, this pretty loose, basically it's K&R.)

Any thoughts, ideas, flames?

-- 
Tollef Fog Heen                                                        ,''`.
UNIX is user friendly, it's just picky about who its friends are      : :' :
                                                                      `. `' 
                                                                        `-  



Reply to: