httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: More for the style guide
Date Tue, 15 Jul 1997 19:30:15 GMT
Rodent of Unusual Size wrote:

> >From the fingers of Alexei Kosut flowed the following:
> >
> >On Tue, 15 Jul 1997, Rodent of Unusual Size wrote:
> >
> >>     o What about "!" as an operator?  Should it be followed by a
> space
> >>       or not?  (IMHO, since it doesn't modify the value the way
> "++" and
> >>       "--" do, I'm inclined to treat it like other operators and
> have it
> >>       followed by a space.)  This also applies to any other unary
> >>       operators, such as negation ("a = -foo" or "a = - foo"?).
> >
> >Yuck. One-character operators should, IMHO, be stuck to the following
>
> >expression.
>
>     Yuck yourself. "x = -foo((int)ptr, !boolfunc(a++, (char *)b))"
> looks
>     attractive to you?  A matter of taste, of course; I would rather
>     read "x = - foo((int) ptr, (! boolfunc(a++, (char *) b)))"
> myself..
>
> >>     o if-then-else blocks are covered, but what about
> if-then-elseif?
> >>       Should the second if-block be in braces?  On the same line as
> the
> >>       else?
> >
> >Yes. Yes. Although there is no "then" in C, AFAIK, so maybe you're
> >talking about something else.
>
>     Don't be tiresome. <g>  So you like the following:
>
>      if (cond1)
>         gritch1;
>      else {if (!cond2) gritch2;}
>
>     How would you structure that for maximal readability?  I'd rather
>     see it as
>
>      if (cond1) {
>         gritch1;
>      }
>      else {
>         if (!cond2) {
>             gritch2;
>         }
>      }

errr..

    if(cond1)
        gritch1;
    else if(!cond2)
        gritch2;

surely? Obviously if gritch1 or gritch2 have more than one statement
they should have {}, but a third is compleley superfluous.

Cheers,

Ben.

--
Ben Laurie [Normal service will be resumed as soon as possible]



Mime
View raw message