ATLAS attempts to use a unified coding style. Older codes may not adhere to it strictly (especially in function prototyping and single-line ifs), but all new codes should do so.
/* */, not //
for (i=0; i < N; i++)
{
for (j=0; j < N; j++)
statement;
}
All braces are lined up this way (eg., ifs, functions & loops).
error = function_call(arg1, arg2, arg3,
arg4, ar5);
if (cond)
statement;
if (cond) statement;
/*
* This comment describes what is going on the below loop body
* and if conditional
*/
if (cond)
{
}
/*
* Comment describing else body
*/
else
{
}
/*
* ======================================================================
* Here is a comment describing the total operation of multiple blocks of
* code which are all individually commented in the above manner
* ======================================================================
*/
for ()
{
if (cond)
....
else if
...
}
int my_func
(
int iparm, /* comment describing this parameter */
void *vp, /* comment describing this paraemter */
...
)
/*
* This mandatory block of comments placed between the func declaration and
* the opening brace describes what the function does. If the function
* returns a value, this block of comments end with line(s) describing the
* the return value, of the form:
* RETURNS: 0 on success, non-zero error message otherwise
* second line describing return value
*/
{
}
<500>>
Clint Whaley 2012-07-10