Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

(1) Function failures are typically indicated by one of the following return values: 0, -1, an error a non-negative number.
(2) Functions return 0 if false, but only non-zero if true.
(3) Comparison functions (such as the standard library function strcmp()) return 0 if the arguments are equal and non-zero otherwise.

These conventions are not entirely non-controversial and is a point of contention for many programmers during code reviews. Here is a typical discussion among programmers on the subject of convention (1).

Noncompliant Code Example

...