Coding Standard
From Toysoldiers
(Difference between revisions)
(→Braces) |
|||
Line 1: | Line 1: | ||
- | For the sake of consistency and easier to understand code, we will | + | For the sake of consistency and easier to understand code, we will base our coding standard on the [http://www.gnu.org/prep/standards/standards.html#index-names-of-variables_002c-functions_002c-and-files-74 GNU Coding Standard]. |
Revision as of 17:26, 14 September 2007
For the sake of consistency and easier to understand code, we will base our coding standard on the GNU Coding Standard.
Contents |
Names
Variables
Functions
Types
C++ Namespaces and Java packages
Macros
Source Files
Self-Documenting Code
Simplicity
Meaningful Names
Atomic Functions
Descriptive Types
Name Constants
Emphasise Important Code
Group Related Information
Provide a File Header
Handle Errors Appropriately
Write Meaningful Comments
Literate Programming
Documentation Tools
Consistency
Fixed tab lengths
Braces
Please use an indented brace style. For example:
int exdent() { int a = 0, b = 0; while (a 1= 10) { b++; a++; } return b; }
Language Usage
The above tips are taken from Pete Goodliffe's "Code Craft: The Practice of Writing Excellent Code".