[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-misc
Subject:    Re: style(9) and return statements
From:       Theo de Raadt <deraadt () cvs ! openbsd ! org>
Date:       2006-04-30 22:07:08
Message-ID: 200604302207.k3UM78be022570 () cvs ! openbsd ! org
[Download RAW message or body]

Any way which is not a real bug or hole.

> 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
> 
> -- 
> Windows is so bootyful...

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic