proposed change to style(9): require yoda style if statements
Dominic Fandrey
kamikaze at bsdforen.de
Wed May 12 07:20:33 UTC 2010
On 11/05/2010 21:36, Eitan Adler wrote:
> 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.
Is this suggestion due to the discussions around yoda-style in
the comments of:
http://www.globalnerdy.com/2010/05/09/new-programming-jargon/
I think the pro-yoda faction actually has more convincing
arguments, though I never considered using yoda-style myself.
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
More information about the freebsd-hackers
mailing list