Hasty Briefsbeta

Bilingual

The Ten Commandments for C Programmers from Henry Spencer (Unix/Plan 9 – 1987)

a day ago
  • Run lint frequently and study its output carefully.
  • Never dereference a null pointer.
  • Cast function arguments to expected types explicitly.
  • Declare library function return types if headers are missing.
  • Check array bounds and avoid using gets().
  • Always check error return codes from functions.
  • Study and reuse libraries instead of reinventing them.
  • Use the K&R brace style for clarity and consistency.
  • Ensure external identifiers are unique in the first six characters.
  • Write portable code; avoid assuming a specific architecture.