1
Writing FB code every coder should keep in mind these rules:
3
- Configure your editor to use 4 position for tabstop.
5
- space after e.g. if/for/while/switch - do "if (", not "if(".
6
- no spaces allowed between function name and leading left paren - do
8
- spaces around operation - do "c = a + b;"
9
- spaces between function's parameters
10
- no spaces with pointer sign - do "*p++ = *q++" and "char *a".
11
- Mandatory braces around scoped code. Closing brace always aligned to the
12
first char of the keyword introducing the scope - i.e.
25
first form is not allowed if condition exeeds one line. Braces may be omitted
26
only if condition doesn't exceed one line and conditional statement also doesn't
29
- No spaces in C++ cast expressions. Do "static_cast<type*>(ptr)", not
30
"static_cast < type * > ( ptr )".
31
- Prefer to keep lines shorter than 80 chars.
32
- Prefer initialization over assignment.
33
- Don't break the build. Before commiting do full build cycle from
34
scratch (on all available platforms).
35
- Always end source files, including headers, with a newline.
36
- Prefer C++ style for comments
37
- Use abstract datatypes (UCHAR, SSHORT, ULONG etc) instead of generic
38
ones (unsigned char, short, unsigned long resp) because generic types
39
can be changed unexpectedly (long int become 64 bits for example).