Re: [AD] About create_bitmap |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Chris wrote:
I'm afraid I'm to blame for this. I didn't like (and still don't like) functions being lenient about incorrect arguments -- incorrect arguments should cause a function to blow up, not be silently corrected. Anyway, I might have taken it too far in this case. Checking for negative arguments to create_bitmap() is probably ok, since it would return NULL anyway and the program unlikely to continue very far.On Wed, 03 Nov 2004 18:31:02 +0100, Elias Pschernig <elias@xxxxxxxxxx> wrote:Well, you could use a simple #define. The vast majority of uses of create_bitmap will not need a check - so this is a very special use. There's of course no problem with create_bitmap, nobody would notice it. But in general, I don't think it is a good idea. Else, we end up having error checking for every single function, like OpenGL.I don't see error checking as a bad thing. It's not hard to do, and in fact is already done via ASSERT. What's so bad about changing an ASSERT (which applies only to debugmode) to if (which is always checked)? The function is not speed-critical, so the more error checking the better.
(Apologies to Lennart, who asked me about this a couple of years ago.)
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?And I think it would be more useful than you think, since there are several situations where you just obtain numbers and then pass them directly to create_bitmap.
Peter
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |