Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#3450) square_iterate and unreal positions
Home

[Freeciv-Dev] Re: (PR#3450) square_iterate and unreal positions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3450) square_iterate and unreal positions
From: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 26 Feb 2003 02:56:06 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, Feb 26, 2003 at 02:47:20AM -0800, Raimar Falke wrote:
> On Wed, Feb 26, 2003 at 02:28:17AM -0800, Per I. Mathisen wrote:
> > 
> > On Wed, 26 Feb 2003, Raimar Falke wrote:
> > > > > It should make the normalization before. It the code wants to pass
> > > > > non-real map positions in it has to use another macro.
> > > >
> > > > I have already proposed this, and you were against it also.Yet some
> > > > resolution is needed, and it should _not_ be to just say the caller has
> > > > to write a local loop.
> > >
> > > What about a mapview_square_iterate or unchecked_square_iterate?
> > 
> > Writing a new iterator which is exactly like the square_iterate only that
> > it doesn't have an assert is plain stupid. If the assert is that much of a
> > bother, remove it. I'm with Ross and Jason on this one.
> 
> As I said before: I'm against weaking the macro just because one user
> doesn't behave in the correct way.

Longer explanation:

There are two types of users of square_iterate:
 - first type always passed normal map positions in. To check this we
 test for this. If we avoid the check we won't notice the problem of
 non-normal positions in the first. This is bad.
 - second type may also pass non-real map positions in. These aren't
 an error here.

Solutions:
 - two macros: current and an unchecked_
 - one macro without the assert. Then the assert has to move out to
 the users of the macro. Programmers will forget to add the test -> bad
 - convert the second of users of square_iterate to the first one: it
 looks like this can be done.

So I go for the first solution.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "> WHY?! Isn't it better to put $(shell cat cscope.files) on the list of
  I only have a yellow belt in makefile kungfu.  These fancy gnu make things
  are relatively new to some of us..."
    -- Mark Frazer to Vassilii Khachaturov in linux-kernel




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