From owner-freebsd-hackers@FreeBSD.ORG Sat May 15 04:48:03 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAFF51065678 for ; Sat, 15 May 2010 04:48:03 +0000 (UTC) (envelope-from rychoo@freeshell.net) Received: from sdf.lonestar.org (mx.freeshell.org [192.94.73.19]) by mx1.freebsd.org (Postfix) with ESMTP id 752E78FC23 for ; Sat, 15 May 2010 04:48:03 +0000 (UTC) Received: from [192.168.0.100] (6.ryb.abpl.pl [80.238.64.13]) (authenticated (0 bits)) by sdf.lonestar.org (8.14.4/8.14.3) with ESMTP id o4F4M8mI008062; Sat, 15 May 2010 04:22:39 GMT Content-Transfer-Encoding: quoted-printable From: "Ryszard W. Czekaj" Content-Type: text/plain; charset=iso-8859-2 Message-Id: Date: Sat, 15 May 2010 06:21:17 +0200 To: 4BEABDBE.6080107@bsdforen.de Mime-Version: 1.0 (Apple Message framework v1078) X-Mailer: Apple Mail (2.1078) Cc: freebsd-hackers@freebsd.org Subject: Re: proposed change to style(9): require yoda style if X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2010 04:48:03 -0000 > 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