From owner-svn-src-all@FreeBSD.ORG Mon Feb 22 13:53:04 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 502B8106568D; Mon, 22 Feb 2010 13:53:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id D80748FC1A; Mon, 22 Feb 2010 13:53:03 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id A425941C70C; Mon, 22 Feb 2010 14:53:02 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id vecoXm1CH68v; Mon, 22 Feb 2010 14:53:02 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 1687341C6B4; Mon, 22 Feb 2010 14:53:02 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 60F584448EC; Mon, 22 Feb 2010 13:52:33 +0000 (UTC) Date: Mon, 22 Feb 2010 13:52:33 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Robert Watson In-Reply-To: Message-ID: <20100222133112.D27327@maildrop.int.zabbadoz.net> References: <201002212103.o1LL3FGS037889@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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 Subject: Re: svn commit: r204178 - head/games/fortune/fortune 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, 22 Feb 2010 13:53:04 -0000 On Mon, 22 Feb 2010, Robert Watson wrote: Hi, > > On Sun, 21 Feb 2010, Ulrich Spoerlein wrote: > >> Prefer exit(0) from main over return(0). >> >> Although not explicitly mentioned in style(9), it allows for easier >> grepping of exit points. This reverts part of r203926. > > A few people (including me) have tripped up over exit handling and style in > the past. It might be nice to formulate some specific sentences about > program exit paths, functions, and also return values, to put in the style > guide. > > For example, we have sysexits(3), but my understanding is we prefer not to > use it. Likewise, we do like to use err()/warn() in preference to perror() > and exit(), etc. I know better but still join this thread; the color shall be red and light blue on white or a light blue on white depending on whether you believe in the new or the old testament. While the old testament seems to talk about exit() in 7.7 Error Handling - Stderr and Exit but treated main() voidish apart from that mostly, the new testament is a bit more precise in 7.6. with the same name: >>Withing main, return expr is equivalent to exit(expr). exit has the advantage that it can be called from other functions, and that calls to it can be found with a pattern-searching program like those in Chapter 5.<< It still seems to be quite common to use return rather than exit in main(), and while style.9 may, in the future, possibly suggest that exit() is the prefered token, we should not start changing all and everything to exit() and still accept return() without major bikesheds. The thing I tripped over in the past were negative s,return,exit, (or err(3)) values which are not really good(tm). I agree with Robert that we should try to decide what, of all the (unused or prefered by some people) possibilities we support, we would prefer but may not forget portability. /bz -- Bjoern A. Zeeb It will not break if you know what you are doing. PS: Whenever you commit to fortune, you will likely start a bikeshed.