The most important thing of standards is being consequent, always using the same choices of naming, code structure, etc. Your code will be easier to understand and to write, you will easier remember variable, type and procedure names. This, together with structured programming techniques makes documentation only necessary for special non-obvious things in your code.
class NameOneTwo // Classes
int mVarAbc; // Class Attributes: start with 'm'
static StatusInfo sStatus; // Static Variables: start with 's'
int handleError(int errorNumber) // Methods & Method Arguments
{
Time time_of_error; // Local Variables
}
explanation of class (terminology, functions, reasons, ...) In implementation: comment only where necessary!! Special non-obvious things. Comments should document decisions
Put a space in between '=', '==', all operators and after comma's! Indentation Policy:
switch (...){ // Switch Format
case 1:
...
// FALL THROUGH
case 2:{
int v;
...
break;
}
default:
}
int SomeMethod(){
if (condition){ // Braces {} Polic
...
}
while (6 == errorNum){ // Condition Format
...
}
}
eg: while ((c = getchar()) != EOF) or i = j++;