From owner-freebsd-standards Sun Dec 2 2:21:38 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id DFB1337B416 for ; Sun, 2 Dec 2001 02:21:33 -0800 (PST) Received: from straylight.ringlet.net (roam@discworld.nanolink.com [217.75.135.248]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with SMTP id fB2ALUG53986 for ; Sun, 2 Dec 2001 05:21:31 -0500 (EST) (envelope-from roam@ringlet.net) Received: (qmail 2318 invoked by uid 1000); 2 Dec 2001 10:20:38 -0000 Date: Sun, 2 Dec 2001 12:20:37 +0200 From: Peter Pentchev To: Garance A Drosihn Cc: Bruce Evans , Wes Peters , Bill Fenner , mike@FreeBSD.org, freebsd-standards@bostonradio.org Subject: Re: strerror_r() implementation Message-ID: <20011202122036.C523@straylight.oblivion.bg> References: <20011202011045.F5026-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from drosih@rpi.edu on Sat, Dec 01, 2001 at 11:47:52PM -0500 Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Dec 01, 2001 at 11:47:52PM -0500, Garance A Drosihn wrote: > At 1:52 AM +1100 12/2/01, Bruce Evans wrote: > > > > > The last change is a whitespace error. Mustn't have any style(9) > > > > > nits, right? ;^) > > > > > > > > I agree, so about 10 more of them in strerror() alone ;^). They > > > > were in the following classes: > > > > (1) missing parens around return values > >> > >> style(9) remains silent on this subject. Until required to do so by > > > >It is not silent, but not very verbose. All of the examples of returning > >a value in style(9) use "return (foo)". There is a whole one such example. > >It apparently didn't occur to the origianal author of style(9) that this > >needed an explicit rule. > > In the argumentative half of my message (this here message...), I will note > that style(9) also says that parenthesis should not be added unless they are > necessary, and previous discussions have indicated that parentheses are not > in fact necessary in C on return statements... The more I have thought > about this, the more I have felt that it is better to NOT use parentheses > on 'return' statements, as that makes it absolutely clear that the return > statement is not a function call. And, when there are no parentheses, then > it is much easier to remember to put a blank between 'return' and the value > being returned ... :-) > I personally have found parentheses on return statements very useful for debugging, should return be redefined as a macro. Something like: #ifdef EBUG #define return(r) return errreturn(r) rs_err_t errreturn(rs_err_t r) { if ((x == RS_ERR_NONE) || (x == RS_ERR_BACKOFF)) return r; rs_prerror("ERR", r); abort(); } #endif ..which provides me with nice tracebacks in addition to the error message at the first point an error is encountered. G'luck, Peter -- What would this sentence be like if it weren't self-referential? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message