Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: list cleaning
Home

[Freeciv-Dev] Re: list cleaning

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: list cleaning
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Fri, 23 Jan 2004 18:17:04 +0000 (GMT)

On Fri, 23 Jan 2004, Raimar Falke wrote:
> > > > > Can you please repeat the problems which the current code has?
> > > >
> > > > unit_list_iterate is unsafe
> > >
> > > Yes but I don't think it is a problem or bug. It is designed this way.
> >
> > It certainly causes bugs. One has to wonder if there are any unsafe
> > uses of it.
>
> Will such bugs show quickly? AFAIK the answer is yes. IMHO the
> cost/benefit ratio for a change is bad.

By experience, such bugs do _not_ show quickly (errors may depend on list
order and rare nested calls) and are not easy to track (random memory
corruption).  I fixed umphteen bugs related to unit_list_iterate after the
allied transport patch and AI diplomacy went into cvs. Took quite a while
before all bugs (we know of) were found and fixed.

I also think it is a good thing in principle to add a *_free call whenever
we have a *_init call to a code module.

  - Per



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