-
Notifications
You must be signed in to change notification settings - Fork 215
The Sourcecode: Formatting and Style
Steffen Jaeckel edited this page Sep 7, 2019
·
5 revisions
The basic formatting—the placing of brackets, how many spaces and where, etc.—are done by a simple make astyle. The program astyle should be available in almost all Linux and BSD distributions and if that is not the case, is available at their home at Sourceforge.
Also one-liners go into curly brackets.
The error-handling is normally done with a goto to the end. That goto has to be at the same line as the error-check itself and without the curly brackets. The goto shall be aligned. Example:
if ((err = mp_add(&a, &b, &c) != MP_OKAY) goto LTM_ERR;
if ((err = mp_incr(&c) != MP_OKAY) goto LTM_ERR;All static and private functions have to have the prefix s_.