Code Constructs

    Table of contents
    No headers

    Unfortunately the current state of the Gromacs code is quite diverse, but for the future we try adhere to the UNIX way of doing things:

    • Typically, a return value of 0 means success/OK, while non-zero error codes e.g. from /usr/include/errno.h indicate bad things.
    • The exception to this is functions with obvious boolean names like is_alpha(), where we return 1 for true, 0 for false.
    • Don't use the return value for other things! To prepare for threading, we need it to propagate error codes.
    • Again, there are exceptions, like standard math functions x=gmx_invsqrt(y);
    • Put arguments in the standard UNIX way, i.e. gmx_copy(to,from), or gmx_print(xlist, nx).

    If in doubt, ask "what would Dennis Ritchie do?", or browse /usr/include for inspiration.

    Page last modified 11:04, 21 Mar 2009 by rossen