Date: Sun, 2 Dec 2001 12:20:37 +0200 From: Peter Pentchev <roam@ringlet.net> To: Garance A Drosihn <drosih@rpi.edu> Cc: Bruce Evans <bde@zeta.org.au>, Wes Peters <wes@softweyr.com>, Bill Fenner <fenner@research.att.com>, mike@FreeBSD.org, freebsd-standards@bostonradio.org Subject: Re: strerror_r() implementation Message-ID: <20011202122036.C523@straylight.oblivion.bg> In-Reply-To: <p05101006b82f5ebd92e6@[128.113.24.47]>; from drosih@rpi.edu on Sat, Dec 01, 2001 at 11:47:52PM -0500 References: <20011202011045.F5026-100000@gamplex.bde.org> <p05101006b82f5ebd92e6@[128.113.24.47]>
index | next in thread | previous in thread | raw e-mail
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 ... :-)
> </argumentative>
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
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011202122036.C523>
