proposed change to style(9): require yoda style if statements
syrinx at FreeBSD.org
Tue May 11 21:39:27 UTC 2010
In my humble opinion,
With proper -W flags (i.e. -Wall -Werror), the compilation will fail on
"if (var = const)"
also yoda statements of the kind
if (constant == variable)
obfuscate code and make it more difficult to read, definately not a
good idea IMHO, added the confusion between old and new code that Max
On Tue, May 11, 2010 at 11:36 PM, Eitan Adler <lists at eitanadler.com> wrote:
>> 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)
> freebsd-hackers at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
More information about the freebsd-hackers