[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If there are several local variables in a function, put them into logical groups, with a blank line between groups. Each group should be preceded by a comment line explaining their purpose as a group.
If some variables are relevant only if another variable is set to a particular value, etc., indicate that as part of a comment.
(These are the same as the rules that apply to structures.)
int *x
, not int* x
.
Avoid global variables, except read-only and write-once, read-many variables.
Avoid static buffers and fixed-size buffers for data of indefinite length. Instead of returning a pointer to a function-local static buffer, use a parameter with a pointer to a buffer to stuff the result into.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |