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: Kevin Brown <kevin@xxxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: K&R style (was Re: [PATCH] slight optimisation ...)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Aug 2001 15:02:07 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Aug 17, 2001 at 07:03:59PM -0700, Trent Piepho 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.

But cvs annotate will also take the revision to annotate. So if the
line was last changed in revision 1.x and 1.x is the "indent" revision
you just annotate revision 1.(x-1). Yes this is a bit more work.

> > sounds like CVS would be of limited usefulness here anyway, since once
> > someone makes a change to a line of code, its origination information
> > is lost, right?
> 
> The idea is that when someone makes a change to a line of code, they are
> CHANGING it.  That's why it is discouraged to commit something that
> does nothing but reformat code.
> 
> > > indent is also not perfect, sometimes programmers have carefully
> > > spaced tables or comments so that they line up and then indent
> > > messes that up.
> > 
> > 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?

Somebody HAS to go through the code and take care of comments and
such.

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

It IS a resurfacing problem. The benefits are relative clear. At least
for me the losses would be marginally: I have rarely used
annotate.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "I haven't lost my mind - it's backed up on tape somewhere."


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