skip to main |
skip to sidebar
Please...
- initialize ALL variables even if they are set few lines later
- write log lines as single line
- write unit tests for methods and messages
- write unit tests for everything, even if it is complicated and takes 1 hour
- use stack variables if possible, avoid pointers
- remember that anything is a UTF-8 string
- if a message handler fails and returns apStatus != Ok, then also fill sComment
- if you write a new module, try to make it run without your new module
- prefer tests in module rather than in the test module
Never ever...
- use non-ASCII characters in code, e.g. "รค". The compiler might see 2 bytes instead of one character
- do anything that can fail in a contructor
- do bullshit
Platform notes:
- do not initialize SAutoPtr pMyClass = new MyClass(). This does not work with gcc. Write: SAutoPtr pMyClass(new MyClass()) or SAutoPtr pMyClass; pMyClass = new MyClass();
Please...
- UpperCamelCase Classes: class Class {};
- lowerCamelCase methods: myMethod() {}
- prefix pointers with "p": Pointer pPointer = new Pointer();
- prefix int (unsigned, long, short) with "n": int nCount = 1;
- prefix SString with "s": SString sString;
- prefix char* (const char*) with "sz": const char* szString = "String"; SString sString = szString;
- prefix float (and double) with "f": double fValue = 0.0;
- lowerCamelCase objects and C++ references of stack/instance variables: MyClass myClass; and MyClass& myClass;