| |
|
 |
Coding Standards - Part 2 - Basic conventions
|
Coding standards define a standard for the look and feel of your code. This is helpful to most projects, and to some it is a necessity. Especially in open source projects. In this second issue I'll show eZ system's standards regarding macros, indentation and brackets.
Macros
Macros and other # commands are to be avoided. Exceptions are #include and the necessary #ifndef/#define/#endif in header files. Macros can be used when there are good reasons to do so, though.
Indentation
Use 4 character indentation, this is commonly used and allows for easy recognition of the indentation level. Use spaces in stead of TABs, to assure the code looks the same everywhere.
Bracket placement
Put begin and end brackets {} on the same column, and on the same column as the statement that "owns" the brackets.
Example
int meaning( int x, int y )
{
if ( x == y )
{
..
}
else if ( x > y )
{
..
}
else
{
..
}
return 42;
}
|
Comment List
| Topic: |
Author: |
Time: |
|
Coding Standards
|
Leone Viru
|
16.12.2003 11:31
|
|
I am truly impressed and happy to feel that my "own" personal coding style is same. Me as a man who wants to see system and order in everywhere I used pure and clear code since the beginning. Because making not ordered code will end up sooner or later with kahos.
|
|
Coding standards !! Well wake up... and take a look at "man
|
Lars Hesdorf
|
03.12.2000 12:14
|
|
Basically fine with an article Coding standards. But when you hare argued about why to preferably use one style instead of an another then please also give the arguments for the "indent" program to us to enforce to coding style.
|
|
 |
|
|