Changes between Version 99 and Version 100 of Developer/Coding/Conventions


Ignore:
Timestamp:
Sep 26, 2018, 5:01:18 PM (12 months ago)
Author:
Joel Sherrill
Comment:

Add avoid using zero as a valid value and validate input parameters

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Coding/Conventions

    v99 v100  
    8282 *  Avoid excess parentheses. Learn the [http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence operator precedence] rules.
    8383 *  Always use parentheses with sizeof. This is an exception to the rule about excess parentheses.
     84
    8485= Robustness =
    8586
    8687 *  Check all return statuses.
     88 *  Validate input parameters.
    8789 *  Use debug assertions (assert).
    8890 *  Use const when appropriate for read-only function parameters and compile-time constant values.
     
    9395 *  Do not shadow variables.
    9496 *  Avoid declaring large buffers or structures on the stack.
     97 *  Avoid using zero (0) as a valid value. Memory often defaults to being zero.
    9598 *  Favor mutual exclusion primitives over disabling preemption.
    9699 *  Avoid unnecessary dependencies, such as by not calling ''printf()'' on error paths.
     
    98101 *  Prefer inline functions, enum, and const variables instead of CPP macros.
    99102 *  CPP macros should use a leading underscore for parameter names and [https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html#Macro-Pitfalls avoid macro pitfalls].
     103
    100104= Portability =
    101105