proposed change to style(9): require yoda style if statements
Eitan Adler
lists at eitanadler.com
Tue May 11 20:03:04 UTC 2010
My proposal is simple:
require that any if statement that compares a constant to a mutable variable
be written as
if (constant == variable)
instead of
if (variable == constant)
this prevents an extremely common programming error
if (variable = constant)
While this is almost always found in testing sometimes thing can slip
through and writing it using the former method will generate a compiler
warning.
More information about the freebsd-hackers
mailing list