On 5 December 2010 22:13, Raphael Langella <raphael.lange...@gmail.com> wrote:
> I agree that it looks like a function call, thus my proposal. Here is
> another one:
>
> put the return expression in parenthesis only if it contains an operator. If
> it is just a single word, value or function call, parenthesis aren't needed.
> Examples:
>
> return 0;
> return variable_name;
> return true;
> return function_call(parm);
>
> return (a + b);
> return (foo == ENUM_FOO || bar == ENUM_bar);

I do agree that having simple coding conventions has got a value of
its own. (We've got enough "indent this if A or B *and*C unless also
D" types of rules. My fault. :p) The simplest decision would be to
either put parentheses around all return values or none, of which I'd
prefer the former (possibly excepting for function calls) by a wide
margin.

While the above suggestion also follows a simple enough system, if you
grep "return (true)" vs. "return true", you'll find there are a LOT
more instances of the former. Surprisingly enough, "return (0)" also
appears to be more common than "return 0". In the interest of avoiding
pointless replacements, I vote to keep this system.

And another point: Many editors allow highlighting of keywords, and a
lot of the time "return", "true", "false", and "NULL" fall into the
same category ("reserved keywords" or whatever). Putting brackets
around values makes it easier to tell at a glance which is which. (And
yay, I've just realized that *this* is the reason I'm not bothered by
enums, numbers or actual variables not being bracketed.)

Cheers,

Johanna

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Crawl-ref-discuss mailing list
Crawl-ref-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss

Reply via email to