[Freeciv-Dev] Re: assert(normalize_map_pos(...)) is bad! (PR#1004)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, Oct 11, 2001 at 02:52:39PM -0700, jdorje@xxxxxxxxxxxxxxxxxxxxx wrote:
> Some of the new (I think) gui-win32 code uses constructs like:
>
> assert(normalize_map_pos(&x, &y));
>
> this is very bad! normalize_map_pos has side effects, and putting it
> inside an assert will mean (x, y) doesn't get normalized when not in
> debugging mode; you'll get a near-certain segfault.
>
> Instead you should use either
>
> assert(is_real_tile(x, y));
> normalize_map_pos(&x, &y);
>
> or
>
> int is_real = normalize_map_pos(&x, &y);
> assert(is_real);
>
> I think Raimar may be trying to make the latter the standard (although
> if so this should be announced and a macro should be created).
No I hope to remove it altogether.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"These download files are in Microsoft Word 6.0 format. After
unzipping, these files can be viewed in any text editor, including
all versions of Microsoft Word, WordPad, and Microsoft Word Viewer."
-- http://www.microsoft.com/hwdev/pc99.htm
[Freeciv-Dev] Re: assert(normalize_map_pos(...)) is bad! (PR#1004),
Raimar Falke <=
|
|