proposed change to style(9): require yoda style if statements

Eitan Adler lists at eitanadler.com
Tue May 11 20:59:01 UTC 2010


> With proper -W flags, "if (var = const)" also yields a warning:
>
>  warning: suggest parentheses around assignment used as truth value
>
> Chaning style(9) in such a fundamental way almost, always isn't a good idea.
> It's simply unrealistic to change all current code to comply and the
> difference between old and new code will just add to the confusion.

Per Julian Elischer
We might suggest it rather than mandate it.
Also this method is compiler agnostic and generates a stronger warning
(an error rather than a warning)


More information about the freebsd-hackers mailing list