Re: [AD] About create_bitmap |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] About create_bitmap
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Thu, 4 Nov 2004 03:37:29 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=npDXxlob1V3Wlo7GsX7x2ZnZm+zGof/eVAu0t/lU8VltSgafus0WHHqRnh0grMrYf9s/Kl8TF9/PbCb/+g4t+oWJVFn3ugi7nxVdha8J6cc9OIfAbvCOLljG2jgGOUCzs8SZk7Lx/l3NjuQCP2dTUbnoWM0TX8M8Zli8wHqlEQ4=
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).