...
When implementing recommendations, it is always necessary to use sound judgment.
(Note that this example does not prevent overflow or check for invalid operations (taking the sqrt()
of a negative number.) See INT32-C. Ensure that integer operations do not result in an overflow and FLP32-C. Prevent or detect domain and range errors in math functions.
Risk Assessment
Using numeric literals makes code more difficult to read and understand. Buffer overruns are frequently a consequence of a magic number being changed in one place (like an array declaration) but not elsewhere (like a loop through an array).
...