THE HOLY C PROGRAMMING COMMANDMENTS
- All files shall begin and end with an empty line.
- Tab characters shall be used for indents, not spaces.
- Indents shall be 4 characters wide.
- There shall be no whitespace between if and (), such as function(), while(), for(), if(), and etc.
- There shall be no whitespace at the end of lines.
- All lines shall be terminated with CRLF. No exceptions. Your computer has more than 8 bits of memory now. We don't care what operating system you think is better.
- All brackets shall be placed on their own line. The reason for this is that idiots do not follow the above rules, and your indents are guaranteed to get messed up somehow and be displayed improperly in dumb editors. In this event, your scope can easily be reconstructed. Additionally, smart editors can take advantage of this and have collapsible code sections, an extremely useful feature.
- One line statements may be placed after loops and conditional statements to save space on the same line. The same line, not the next, for the above reasons.
- There shall be no stupid maneuvers to avoid returning in the middle of a function.
- goto statements are permissible, as long as they are in good taste, which is extremely infrequent.
- All structs shall be typedef. It's stupid not to.
- Forward function declarations shall not be used, except to resolve circular dependency, or to declare external functions, as per their intended use.
- A newline shall appear at the beginning and end of every file.
- No whitespace shall appear around operators, such as = or ->.
- For absolute clarity, all boolean conditionals shall reside in their own set of ().
- You are a human, not a compiler. Your code should be human readable. Leave optimization to the compiler.