Source code style¶
Indentation¶
ANSI style indentation is used for all source files. Braces appear on a line of their own, at the same indent level as the parent code. Code within braces is indented by a single tab character.
For file headers to line up correctly your editor should be set to use 4-character indents.
File names¶
Assembly¶
Assembly-language file names are "camel cased", are suffixed with the relevant architecture, and use the .asm extension. Example: MD5_x86.asm
C++¶
C++ file names are "camel cased".
Identifier names¶
Classes¶
Class names are "camel cased" and do not have an initial "C". Examples: NetworkSocket, Client, WorkUnit.
Local variables¶
Local variables are camel cased with an initial lowercase letter. Examples: guess, workUnit.
Member variables¶
Member variables use the same naming conventions as local variables but are prefixed with an m_. Some structures with no member functions do not use the m_ prefix.
Global variables¶
Global variables use the same naming conventions as local variables but are prefixed with a g_. Examples: g_bCracking, g_abortedWork
Function parameters¶
Function parameters use the same naming conventions as local variables.
If a thread procedure takes a parameter casted from void* type, the void* parameter should have the same name as the casted parameter but be prefixed with an underscore. If a thread procedure takes no meaningful parameters the void* parameter should be named _notused.
Member functions¶
Member function names are camel cased.
Global functions¶
Global functions use the same naming conventions as member functions.