httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject Re: Minor(?) style questions
Date Mon, 11 Mar 2002 14:04:57 GMT

-----
> Hi,
>
> Just checking if people have given this some thought before.
> And, maybe if there was something decided on this matter.  For
> instance, that this is free when it comes to style rules.
>
> As some of you have noticed I am doing style reviews of/
> corrections on the current httpd codebase, which has the nice
> sideeffect of getting us some basic code review aswell.  With
> everything in a consistent style, review by other parties will
> be easier aswell.  Not to mention that one can probably read
> the code quicker...
>
> So, just a few simple questions:
>
> 1) Can we decide on a standard style when it comes to using
>    ++ or --?
>
>    Example:
>
>    lines++;
>
>    vs.
>
>    ++lines;
>
>    We are currently mixing this in the current code base.
>    I personally favor the first.  And unless we are testing
>    the variable in an expression, pre- or postfix doesn't
>    matter for the resulting binary, only for readability.
>
>

I would vote for both :-) Either are equally readable IMHO (I tend to use the first,
FWIW).

> 2) How should a do {} while look like?
>
>    do {
>        ...
>    } while (...);
>
>    or
>
>    do {
>        ...
>    }
>    while (...);
>

The first style is more compact and not less readable than the second, IMO.

>
> 3) What is the preferred method of doing an infinite loop?
>
>    while (1) {
>        ...
>    }
>
>    or
>
>    for (;;) {
>        ...
>    }
>
I like using the while(1) style. No justification ...

>
> Thanks,
>
> Sander

I would prefer to keep the style guidelines as small as possible. I would be in favor of
adding 2) to the existing guidelines and leaving 1) and 2) personal choice.

Bill


Mime
View raw message