httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: [proposal] styleguide tweak
Date Fri, 03 Oct 2003 00:12:38 GMT
On Thu, Oct 02, 2003 at 05:38:12PM -0400, Cliff Woolley wrote:
> 
> So this is NOT intended to be the catalyst for a huge heated debate, it's
> just a suggestion, but I propose the following tweaks to the styleguide.
> For the most part, it's just clarifying the English.  The only real
> changes are ones intended to codify two items most of us already do
> anyway: (a) if there is a multi-line conditional expression (with
> if/for/etc), then you put the { on the next line to separate the code from
> the condition; (b) all blocks should have {}'s, even if they are only one
> line long.

Agreed, with one minor mod to multi-line conditionals:

>...
>     if (foo && bar && baz &&
>         quux && crash && burn)
>     {
>         then();
>     }

"should be":

     if (foo && bar && baz
         && quux && crash && burn)
     {
         then();
     }

Note the operator on the next line. It lends focus to the fact that you're
combining conditions, and _how_ they are being combined (or/and). It is
harder to read them at the end of a conditional. It isn't as obvious with
your example, but if you have something like:

    if (some_function_call(with, arguments, out, the wazoo) ||
        another_function_call(with, more, arguments))
    {

vs

    if (some_function_call(with, arguments, out, the wazoo)
        || another_function_call(with, more, arguments))
    {

The latter is much easier to quickly read/parse.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message