From owner-freebsd-hackers@FreeBSD.ORG Tue May 11 20:59:01 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 B9FC1106567C for ; Tue, 11 May 2010 20:59:01 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 77ED28FC1B for ; Tue, 11 May 2010 20:59:01 +0000 (UTC) Received: by vws12 with SMTP id 12so1070531vws.13 for ; Tue, 11 May 2010 13:59:00 -0700 (PDT) Received: by 10.220.123.5 with SMTP id n5mr506529vcr.249.1273610195450; Tue, 11 May 2010 13:36:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.122.31 with HTTP; Tue, 11 May 2010 13:36:15 -0700 (PDT) In-Reply-To: <201005112233.24473.max@love2party.net> References: <201005112233.24473.max@love2party.net> From: Eitan Adler Date: Tue, 11 May 2010 23:36:15 +0300 Message-ID: To: Max Laier Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: proposed change to style(9): require yoda style if statements 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: Tue, 11 May 2010 20:59:01 -0000 > 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 id= ea. > 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)