Date: Sat, 15 May 2010 06:21:17 +0200 From: "Ryszard W. Czekaj" <rychoo@freeshell.net> To: 4BEABDBE.6080107@bsdforen.de Cc: freebsd-hackers@freebsd.org Subject: Re: proposed change to style(9): require yoda style if Message-ID: <FAFC5968-9B63-44F9-94C1-883B2F7CC44A@freeshell.net>
next in thread | raw e-mail | index | archive | help
> The convincing one applies to Java and C++: > if (constant.equals(object)) > instead of > if (object !=3D null && object.equals(constant)) > actually looks easier to read. >=20 > Though you are right about constants being pretty rare. >=20 > > Your .sig is strangely appropriate... >=20 > Not my invention, this is a pretty common one, used by many people > on the net. I actually have no idea where it comes from. I think that this second is safer because using of null object = caught/trow exception in any language, so you are checking at first if = object exist and if you are using by calling object.equals.. --- +48 882 723907 http://Czekaj.net.pl/ Version: 3.12 GIT d- s: a+ C++ UB+++ P+ L- E--- W+++ N+ o-- K++ w++ O M++ V- PS+++ PE- = Y+ PGP+ t 5 X+ R* tv+ b+ DI D++ G e+++ h! r% y+ --- = https://www.paypal.com/cgi-bin/webscr?cmd=3D_s-xclick&hosted_button_id=3DS= QDJ4F2KX3LYG BZ WBK S.A. 1 Oddz. Wodzis=B3aw =A6l=B1ski SWIFT BiC: WBKPPLPP PLN PL 66 1090 1766 0000 0001 1209 3433 EUR PL 74 1090 1766 0000 0001 1209 3433 GBP PL 62 1090 1766 0000 0001 = 1004 4671
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FAFC5968-9B63-44F9-94C1-883B2F7CC44A>