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: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...)
From: Kevin Brown <kevin@xxxxxxxxxxxxxx>
Date: Sun, 19 Aug 2001 15:40:15 -0700

Trent Piepho <xyzzy@xxxxxxxxxxxxx> wrote:
> On Fri, 17 Aug 2001, Kevin Brown wrote:
> > > That's really not a good idea.  It completly messes up the CVS
> > > history, as you would no longer be able to tell when a line of code
> > > was written.  
> > 
> > You can't retrieve the entire history of a line from CVS?  If it can
> 
> If you use cvs annotate you only get the most recent change to a line of
> code.  I know I used this a lot to track down bugs.

Well, as Raimar said, you can get this on a per-version basis, so you
just go back to the version prior to the Big Change.

> > There are ways to give hints to indent.  The manpage says that boxed
> > comments are left alone, so there's a way to preserve the formatting
> > of comments.  It also says that you can put blocks that you don't want
> > it to touch between /* *INDENT-OFF* */ and /* *INDENT-ON* */.  Issues
> > like this can be cleared up with further patches once the indent run
> > has been committed, for anything that the CVS maintainers miss.
> 
> You want to go thought every single line of code making sure that indent
> actually made it look nicer than what was there before?

No.  Instead, we apply indent, and then whoever *actually cares about
it* can submit patches to fix the formatting.  What will actually
happen is that people will submit such patches as they notice areas
where the formatting is screwed up.

> > Given all the discussion that the issue of style has generated so far,
> > and will probably continue to generate in the future, it seems to me
> > that it's worth doing the indent run once and taking the initial hit
> > against some of the nicely-formatted stuff in order to settle the
> > problem of inconsistent formatting of the code once and for all.  It's
> > also a good long-run strategy because patch submitters will have one
> > less nitpicky thing to worry about.
> 
> Back in 1998 we decided against this, and CVS had just been started
> up and there was a lot less code.  It would be an even worse idea
> now.  It's not like not having the exact same indention style is
> some kind of huge problem.  If half the code had 8 space indents and
> half had 2 spaces, or half was K&R braces and half had that
> butt-ugly GNU stair-step style then maybe it would be worth it.

This is not at all evident by the amount of discussion about
formatting on the list and the current insistence that patches be
properly formatted.

What I'm proposing is that instead of making *everyone* do formatting
work *every time*, we format all the code once and have the CVS
maintainers do a formatting run on patches whenever they're submitted.
That way the work is limited to the CVS maintainers and, more
importantly, it can be automated.  It'll create a short burst of
initial work, followed by a bit of work as people who care about it
submit formatting patches to fix up things like tables, and in the
long run it'll reduce the amount of work the community at large needs
to do.  Sounds like a short-term loss for a long-term gain.  My kind
of tradeoff.  :-)


-- 
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]