Date: Tue, 14 Dec 2010 17:04:38 +0100 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Bruce Evans <brde@optusnet.com.au> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI <delphij@FreeBSD.org> Subject: Re: svn commit: r216422 - head/usr.bin/printf Message-ID: <20101214160438.GF1715@garage.freebsd.pl> In-Reply-To: <20101214183752.L870@besplex.bde.org> References: <201012140021.oBE0LZI9097999@svn.freebsd.org> <20101214183752.L870@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <pjd@FreeBSD.org> .\" 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/--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101214160438.GF1715>