Date: Wed, 12 May 2010 00:14:18 +0300 From: Shteryana Shopova <syrinx@FreeBSD.org> To: Eitan Adler <lists@eitanadler.com> Cc: Max Laier <max@love2party.net>, freebsd-hackers@freebsd.org Subject: Re: proposed change to style(9): require yoda style if statements Message-ID: <AANLkTil0xdCwS1todhuOCKoHNYKBPLBkLSOUOsOCZggP@mail.gmail.com> In-Reply-To: <AANLkTina6dN7kKJwDJLHW9m7oOC12kfBV8Ge4NJaIGb7@mail.gmail.com> References: <AANLkTimCLELSQ9YNZ403_PLhKOQCQTcl9H1bfb1ccRNb@mail.gmail.com> <201005112233.24473.max@love2party.net> <AANLkTina6dN7kKJwDJLHW9m7oOC12kfBV8Ge4NJaIGb7@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In my humble opinion, With proper -W flags (i.e. -Wall -Werror), the compilation will fail on "if (var =3D const)" also yoda statements of the kind if (constant =3D=3D 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 mentioned. cheers, Shteryana On Tue, May 11, 2010 at 11:36 PM, Eitan Adler <lists@eitanadler.com> wrote: >> With proper -W flags, "if (var =3D const)" also yields a warning: >> >> =C2=A0warning: suggest parentheses around assignment used as truth value >> >> Chaning style(9) in such a fundamental way almost, always isn't a good i= dea. >> 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@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTil0xdCwS1todhuOCKoHNYKBPLBkLSOUOsOCZggP>