772 B
772 B
wolfssh notes
coding standard
-
Exceptions are allowed with good reason.
-
Follow the existing style.
-
Try not to shorthand variables, except for ijk as indicies.
-
Lengths of arrays should have the array name followed by Sz.
-
Single return per function.
-
Check all incoming parameters.
-
No gotos.
-
Check all return codes. It feels a little tedious, but the preferred method is running checks against success. This way if a function returns an error, the code will drop to the end.
ret = functionCall(parameter);
if (ret == SUCCESS)
ret = secondFunctionCall(otherParameter);
if (ret == SUCCESS)
ret = thirdFunctionCall(aParameter, anotherParameter);
cleanUp();
return ret;