From owner-svn-src-all@FreeBSD.ORG Mon Nov 28 05:46:22 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 501A3106564A; Mon, 28 Nov 2011 05:46:22 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id E9DB38FC13; Mon, 28 Nov 2011 05:46:21 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 4963C628E; Mon, 28 Nov 2011 05:46:19 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id A961D897C; Mon, 28 Nov 2011 06:46:18 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: David Chisnall References: <201111220250.pAM2oPWC070856@svn.freebsd.org> <20111122153332.GA20145@zim.MIT.EDU> <20111122202735.GA21442@zim.MIT.EDU> <0DC88C34-91B4-49D1-AA8A-73B14C99D35B@FreeBSD.org> Date: Mon, 28 Nov 2011 06:46:18 +0100 In-Reply-To: <0DC88C34-91B4-49D1-AA8A-73B14C99D35B@FreeBSD.org> (David Chisnall's message of "Wed, 23 Nov 2011 10:37:14 +0000") Message-ID: <86vcq4er4l.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, Eitan Adler , svn-src-all@FreeBSD.org, dim@FreeBSD.org, Brooks Davis , bde@FreeBSD.org, svn-src-head@FreeBSD.org, David Schultz Subject: Re: svn commit: r227812 - head/lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2011 05:46:22 -0000 David Chisnall writes: > As to the | vs || issue - by all means change it to || if it fits > better with the FreeBSD style. In the general case I prefer to use | > to hint to the compiler and readers of the code that short-circuit > evaluation is not required and to remove a sequence point and make > life easier for the optimiser. The optimizer is smarter than you think, although it can sometimes get confused when programmers start talking about what they want the optimizer to do instead of what they want the program to do. > In this case, the two are equivalent so it's just a hint to the > reader, and apparently (judging by the responses so far) one that is > not well understood. The reader doesn't need a hint to understand what (n =3D=3D 0 || s1 =3D=3D = s2) means. The reader will however need a couple of seconds to understand what ((n =3D=3D 0) | (s1 =3D=3D s2)) means, and will waste a few more wonde= ring why the programmer didn't pick the more obvious solution. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no