Re: coding style (was Re: [PATCH][2.5] UTF-8 support in console)

Steven Cole (elenstev@mesatop.com)
31 May 2003 11:14:08 -0600


On Sat, 2003-05-31 at 09:39, Larry McVoy wrote:
> On Sat, May 31, 2003 at 04:01:50PM +0100, Dave Jones wrote:
> > Saving a line over readability is utterly bogus.
>
> I agree 100%. If you have anything more complex than
>
> if (error) return (error);
>
> I want it to look like
>
> if ((expr) || (expr2) || (expr3)) {
> return (error);
> }
>
This may just be pedantic minutiae, but aren't those parenthesis around
"error" unnecessary?

Here is a proposal for coding style: Only use parenthesis in the return
statement when needed.

return -ETOSENDERADDRESSUNKNOWN; /* this is OK */
return (value & ZORRO_MASK); /* so is this */
return (-ENOTENOUGHCOFFEE); /* bogus parenthesis */

Steven

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/