From owner-svn-src-all@FreeBSD.ORG Wed Dec 15 12:18:06 2010 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 8A3BD106564A; Wed, 15 Dec 2010 12:18:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 237A48FC12; Wed, 15 Dec 2010 12:18:05 +0000 (UTC) Received: from c211-30-187-99.carlnfd1.nsw.optusnet.com.au (c211-30-187-99.carlnfd1.nsw.optusnet.com.au [211.30.187.99]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id oBFCI16x032034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 15 Dec 2010 23:18:02 +1100 Date: Wed, 15 Dec 2010 23:18:01 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20101214160438.GF1715@garage.freebsd.pl> Message-ID: <20101215231704.K1360@besplex.bde.org> References: <201012140021.oBE0LZI9097999@svn.freebsd.org> <20101214183752.L870@besplex.bde.org> <20101214160438.GF1715@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Xin LI , Bruce Evans Subject: Re: svn commit: r216422 - head/usr.bin/printf 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: Wed, 15 Dec 2010 12:18:06 -0000 On Tue, 14 Dec 2010, Pawel Jakub Dawidek wrote: > 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: >> >> % Exits should be 0 on success, or according to the predefined values >> in >> % sysexits(3). >> % >> % exit(EX_OK); /* >> % * Avoid obvious comments such as >> % * "Exit 0 on success." >> % */ >> >> 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 change >> the comments, so that the comments don't match the code). [Here this was >> originally just a bad example of an obvious comment. The code said >> 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 > =================================================================== > --- 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 I think it is not so obviosly wrong as to be an example of what not to do. Bruce