Re: [AD] About create_bitmap

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Thu, 04 Nov 2004 20:15:57 +1100, Peter Wang <tjaden@xxxxxxxxxx> wrote:
> This is still a bad idea if you're not sure about the numbers you
> obtained.  You might have code that "works" in release mode, but not in
> debug mode (as it shouldn't).  Or do you mean to get rid of the ASSERTs
> completely and replace them with if's?

Well, I think it's best to just replace them with if()'s. As far as
I'm concerned, code should not crash (or ASSERT) unless given
unhandlable parameters (or if it's a speed-critical function and you
want to reduce code for release mode). create_bitmap(_ex) is not
speed-critical and negative sizes can be detected easy enough, and the
function can return an error (NULL).

Besides, letting a function crash can wreak havoc on the rest of the
system (for certain systems), and I think we should avoid that when
possible. The docs say that the functions return NULL if the bitmap
can't be made, but say nothing about crashing/asserting on negative or
0 values (where one would logically assume the function would just
return NULL because a bitmap of such a size can't be made).




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/