From owner-svn-src-head@FreeBSD.ORG Tue Dec 14 16:04:49 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4607D1065672; Tue, 14 Dec 2010 16:04:49 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 991088FC08; Tue, 14 Dec 2010 16:04:48 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 6378045C9B; Tue, 14 Dec 2010 17:04:47 +0100 (CET) Received: from localhost (pdawidek.whl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id E9AC0456B1; Tue, 14 Dec 2010 17:04:41 +0100 (CET) Date: Tue, 14 Dec 2010 17:04:38 +0100 From: Pawel Jakub Dawidek To: Bruce Evans Message-ID: <20101214160438.GF1715@garage.freebsd.pl> References: <201012140021.oBE0LZI9097999@svn.freebsd.org> <20101214183752.L870@besplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FeAIMMcddNRN4P4/" Content-Disposition: inline In-Reply-To: <20101214183752.L870@besplex.bde.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI Subject: Re: svn commit: r216422 - head/usr.bin/printf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Dec 2010 16:04:49 -0000 --FeAIMMcddNRN4P4/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 14, 2010 at 07:26:13PM +1100, Bruce Evans wrote: > (*) Reading between the lines, I wilfully misinterpret this example of > being a bad example of everthing it does: >=20 > % Exits should be 0 on success, or according to the predefined value= s=20 > in > % sysexits(3). > %=20 > % exit(EX_OK); /* > % * Avoid obvious comments such as > % * "Exit 0 on success." > % */ >=20 > Things not to do that are done in this example include: > - use EX_OK, not 0 on success > - place comments to the right of the code and extend them across multiple > lines for maximal waste of space > - when changing code to use EX_OK (or anything, be sure to neglect to cha= nge > the comments, so that the comments don't match the code). [Here this w= as > originally just a bad example of an obvious comment. The code said=20 > exit(0) > and the comment said 0 too. Now it doesn't say EX_OK, so it is not so > obvious that this is an obvious comment (in fact, EX_OK does equal 0, > but this is of no interest here).] > This example could be further improved by adding an obvious NOTREACHED > comment to it. I think I've a fix for this. Could you please review the patch below? Index: share/man/man9/style.9 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- share/man/man9/style.9 (wersja 215409) +++ share/man/man9/style.9 (kopia robocza) @@ -1,5 +1,6 @@ .\"- .\" Copyright (c) 1995-2005 The FreeBSD Project +.\" Copyright (c) 2010 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -26,7 +27,7 @@ .\" From: @(#)style 1.14 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd December 17, 2008 +.Dd December 14, 2010 .Dt STYLE 9 .Os .Sh NAME @@ -611,6 +612,9 @@ * Avoid obvious comments such as * "Exit 0 on success." */ + /* + * NOTREACHED + */ } .Ed .Pp --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --FeAIMMcddNRN4P4/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk0HlZYACgkQForvXbEpPzQrqQCguSFffaJ5c3eDg75bsgPDk3N0 i68AoKYF/3sen3h/cDMQu1ohoLft8DPa =bfxp -----END PGP SIGNATURE----- --FeAIMMcddNRN4P4/--