Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...)
Home

[Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Justin Moore <justin@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...)
From: Kevin Brown <kevin@xxxxxxxxxxxxxx>
Date: Fri, 17 Aug 2001 10:28:07 -0700

Justin Moore <justin@xxxxxxxxxxx> wrote:
> 
> > >Other people (like me) like && at the end better, and it's more common that
> > >way in the code.
> >
> > I like Gautes' way; this is indent -kr2 -bbo, which puts it on the wrong
> > side of the rules though.
> 
>    For the record the K&R style is at the beginning (which I prefer, too).
> It's not explicity laid out, but an example is on p130 of "The C
> Programming Language".  But as Trent pointed out, it's pretty evenly split
> and just a matter of style.
> 
>    WRT braces around single-line statements, the K&R style relies on
> indentation instead of braces.  I don't prefer this; again, it's a matter
> of style. *shrug* An example can be found on p134 of the same book (and in
> other places, but p134 was the first example I found after checking the
> logical operator bit :)).

The advantage of using braces is that it's less trouble to add
statements later.  Other than that, I don't have any real preference.

As for whether operators go at the beginning or end, I have little
preference there, either.  I tend to put them towards the end to make
it more clear that the next line is a continuation, but can see the
advantages to doing it the other way.


None of this should have any real effect on the ability of anyone
reasonably fluent in C to read the code.  In other words, this stuff
is trivia.  :-)


To be honest, I don't understand why we're even discussing this,
except for deciding which arguments to pass to indent.  Seems to me
that we should decide on one and then run the entire source tree
through indent with the appropriate arguments.  Afterwards, it doesn't
matter what style patches are submitted in, since the CVS maintainers
can apply the patch and then run the affected source through indent
again prior to committing the result to CVS.  That way the style
throughout the source that's actually stored in CVS (and against which
all patches are made) with will remain consistent while patch
submitters won't have to concern themselves with something as trivial
as coding style.

As long as patch submitters adhere to certain guidelines (like naming
conventions) things should be pretty smooth, don't you think?


-- 
Kevin Brown                                           kevin@xxxxxxxxxxxxxx

    It's really hard to define what "unexpected behavior" means when you're
                       talking about Windows.


[Prev in Thread] Current Thread [Next in Thread]