[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
assert()
invocation into multiple shorter
ones, both for readability and for more-specific reports as to which
assertion triggered.
this
pointer.
Prototypes for static functions should either all go at the top of the file, separated into groups by blank lines, or they should appear at the top of each page of functions.
Don't comment individual prototypes, but a comment on each group of prototypes is often appropriate.
Don't use parameter names in prototypes, except when there is
considerable danger of confusion. If you use parameter names in public
header files, don't forget to use the proper name prefix. Proper use of
types along with const
can often make the purpose of parameters
clear without any need for names. For example, each parameter's purpose
should be clear in this prototype, even without names: void
copy_string (void *, const void *, size_t);
const
const
aggressively on pointer parameters to functions.
Whether to use const
for double-pointer parameters (const
char **
, etc.) is debatable, because double pointers whose targets have
different qualifiers are not compatible, forcing casts in many cases.
(See Steve Summit's C
FAQ, question 10.11, for more information.)
Especially tricky functions should be rewritten until they are clear. If this is not possible for whatever reason, detailed explanatory comments are a second choice.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |