Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[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: Sun, 30 Nov 2003 14:06:10 +0000 (GMT)

On Sun, 30 Nov 2003, Raimar Falke wrote:
> > > > Not if deletions only happen in extremely rare cases. This does happen.
> > >
> > > Yes. However we will know that this happens.
> >
> > Not if we don't catch it. Players test more code paths in the game than we
> > do.
>
> We catch it with the assert.

How can you be sure we will test the code path that generates the rare
bug? Autogames do not test every code path.

> Look we have unsafe iterators (unlink during iterate). In the past we
> used a safe version in the rare cases were we needed it.

Actually a number of different approaches were used. Sometimes the
iterator pointer was passed to a function that might do an unlink,
sometimes unit_list_iterate_safe was used, and sometimes a custom solution
was made that did almost the same as unit_list_iterate_safe
(ai_manage_units, civil war and another). It used to be pretty ugly, and
it became quite buggy.

The reasons it 'became' buggy was 1) allied transports and 2) AI
diplomacy. The former generated a high number of subtle errors and the
latter uncovered a number of rare errors that had always been there.

> The safe versions then were removed. So we can either revert the change
> and reinstall the safe versions (this was rejected of reasons which may be
> facts or not) or we replace it with something better. And better here
> means for me that we build a safer version which always works. The
> older code with the safe iterators had low runtime impact and used to
> have low code impact.

I agree we should find something better with low runtime impact and low
code impact. I hold that the solution I suggested is the best in both
respects - it is fastest and requires least changes to present and future
code.

I am not sure why we are having this meta-discussion, though. Can we get
back to the technical merits of the different approaches, please?

  - Per



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