8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00
firebird-mirror/doc/README.coding.style

34 lines
1014 B
Plaintext
Raw Normal View History

2003-08-14 12:26:15 +02:00
Writing FB code every coder should keep in mind these rules:
- Configure your editor to use 4 position for tabstop.
- indent: 1 tab
- space after e.g. if/for/while/switch - do "if (", not "if(".
- no spaces allowed between function name and leading left paren - do
"foo()", not "foo ()".
- spaces around operation - do "c = a + b;"
- spaces between function's parameters.
- no spaces with pointer sign - do "*p++ = *q++" and "char *a".
- Mandatory braces around scoped code. Closing brace always aligned to the
first char of the keyword introducing the scope - i.e.
if (foo) {
// code
}
or
if (foo)
{
//code
}
second form is preferable.
- No spaces in C++ cast expressions. Do "static_cast<type*>(ptr)", not
"static_cast < type * > ( ptr )".
- Prefer to keep lines shorter than 80 chars.
- Prefer initialization over assignment.
- Don't break the build. Before commiting do full build cycle from
scratch (on all available platforms).
- Always end source files, including headers, with a newline.