Skip to content

The Sourcecode: Formatting and Style

Christoph Zurnieden edited this page Sep 6, 2019 · 5 revisions

Formatting

Basic Formatting

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.

Exceptions

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 with an 8 (eight) spaces gap and without the curly brackets. Example:

if ((err = mp_add(&a, &b, &c) != MP_OKAY )        goto LTM_ERR;

Style

All static and private functions have to have the prefix s_.

Clone this wiki locally