Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] map_adjust_x (was: Profiling Civserver again)
Home

[Freeciv-Dev] map_adjust_x (was: Profiling Civserver again)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Thue <thue@xxxxxxx>
Cc: Freeciv-Dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] map_adjust_x (was: Profiling Civserver again)
From: Mike Kaufman <mkaufman@xxxxxxxxxxxxxx>
Date: Thu, 2 Aug 2001 12:36:45 -0500

> How about this from gui-gtk/mapview.c:311
>    map_adjust_x(map_view_x0+map_canvas_store_twidth)
> it is perfectly possible for map_canvas_store_twidth to be > map.xsize.
> 

Yes, I agree that the stuff in mapview, etc is the problem, but, should it be 
perfectly possible? (see my response to Reinier)

> True, you could check all uses. But to limit map_adjust_x like this 
> would just make it into a minefield for programmers. Then rather have 
> freeciv run a little bit slower IMO.

I can agree with the possible end result: if the general consensus is that 
safer is better, then no problem. But I don't agree with the particular 
reasoning. map_adjust_x() is like any other function or macro. If a programmer 
wants to use it, then he had better know what it's going to do. If that takes 
documenting the code, so be it. map_adjust_x() is not a safety net. It ought to 
exist primarily because our game happens to wrap around in the x direction. 
Input, by design, will go a bit out of bounds.

-mike


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