[Freeciv-Dev] Re: (PR#6380) remove is_real and is_valid sanity variables
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#6380) remove is_real and is_valid sanity variables |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Fri, 3 Oct 2003 12:32:08 -0700 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
John Wheeler wrote:
> [jdorje - Thu Oct 2 23:47:02 2003]:
>
>
>>Most places in the code use this form:
>>
>> if (!normalize_map_pos(&x, &y)) {
>> assert(0);
>> }
>
>
> Hmm... for a quick solution, would "assert(normalize_map_pos(&x, &y);"
> work?
No, it absolutely would not. Anything include in the assertion is not
compiled at all if debugging is not used.
> I hate getting 'assert(0)' as an error message, because it
> gives absolutely no indication what the problem is. What I'd much
> rather see is something like:
>
> if (!normalize_map_pos(&x, &y)) {
> die("Map position %d,%d not normalized.", x, y);
> }
That would also work. I've considered turning this into a macro form in
the past; something like
#define normalize_real_map_pos(x, y) \
if (!normalize_map_pos(x, y)) assert(0);
which would make die a bit less clunky.
Although I'm not sure what you have against assert? It tells you what
line the failure is on, which allows it to be easily tracked down.
jason
[Freeciv-Dev] (PR#6380) remove is_real and is_valid sanity variables, John Wheeler, 2003/10/06
[Freeciv-Dev] (PR#6380) remove is_real and is_valid sanity variables, Guest, 2003/10/06
|
|