[Previous] [Contents]


Sidebar 1 - C Coding Suggestions

* Don't use = in an if statement expression, unless it is absolutely necessary.
* Define a macro EQ for ==, and never use ==.
* Define macros for &, |, &&, and ||.
* Define macros for BOOL, TRUE, and FALSE.
* Use only Boolean-valued expressions in if statements.
* Use only Boolean variables with the logical operators && and ||.
* Do all assignments as separate statements, not as part of a more complex expression.
* Use parentheses in expressions to explicitly define order of evaluation.
* Don't use %i format specifications or numbers that begin with 0.
* Be sure to code addresses for arguments to scanf and similar functions.

[Previous] [Contents]