Nick Guenther wrote:
>
> On 4/30/06, Matthias Kilian <[EMAIL PROTECTED]> wrote:
> > Hi!
> >
> > I wonder what the preferred style of return statments is -- for
> > returning simple values, both styles
> >
> > return foo;
> >
> > and
> >
> > return (foo);
> >
> > are used in the sources everythen and now. For me, the latter hurts
> > my eyes, since return just expects an rvalue which doesn't need
> > brackets (except for more complex expressions that actually need
> > brackets).
> >
> > In addition, return statements in void functions are just
> >
> > return;
> >
> > and not
> >
> > return ();
> >
> > (which wouldn't be syntactically correct)
> >
> > Simplified, the syntax is something like
> >
> > return_stmt:: RETURN ';'
> > | RETURN expr ';'
> > ;
> >
> > So why do so many people put brackets around the returned expression?
> > And what's the preferred style for OpenBSD?
> >
> > Ciao,
> > Kili
>
> I was wondering this myself last week, but I remembered that someone
> once said "check all the examples before deciding style(9) is silent
> on an issue" and so I did. The examples all use `return (expr);`. I
> didn't pursue it any further because in the two files I checked that
> was the style used as well, but now that I know not all programs are
> the same I wonder what the official word is?
>
> -Nick
There is a
return (eight);
in man style.
I suspect that bad things can happen with macros
when you do only sensible things with parens.