Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: (PR#9870) bad assert in aitools.h
Home

[Freeciv-Dev] Re: (PR#9870) bad assert in aitools.h

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#9870) bad assert in aitools.h
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 30 Aug 2004 15:30:58 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9870 >

Gregory Berkolaiko wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9870 >
> 
> On Sun, 29 Aug 2004, Jason Short wrote:
> 
> 
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=9870 >
>>
>>assert(find_unit_by_id(punit->id))
>>
>>but pointer checks need to be explicit on some platforms in assert 
>>(presumably because their implementation of assert sucks).
>>
>>So it should be a != NULL check.
> 
> 
> isn't this assert a bit crazy?
> because if find_unit_by_id fails, it means that there is no such unit and 
> punit is pointing to some pretty much random data!

Well it is certainly a bug if it happens.  But we usually want to catch 
the error ASAP when this happens.  A segfault later on is likely but who 
knows when it will happen.

jason




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