Page 1 of 1

[Implemented] Error result for CreateImage()

Posted: Sun Apr 26, 2009 12:01 am
by Mistrel
From what I can tell from the documentation, CreateImage has no error result if the image creation fails (e.g. not enough memory). For reliable error catching I would like to see this added.

For example, the function can return -1 on an error.

Posted: Sun Apr 26, 2009 12:28 am
by Arctic Fox
Isn't it just returning 0 when encountering an error or have I misunderstood something?

Posted: Sun Apr 26, 2009 12:38 am
by Mistrel
Returning 0 would work too. My point is there's nothing in the documentation that identifies what it returns if it returns anything on an error. Or if it just crashes the program.

Re: Error result for CreateImage()

Posted: Sun Apr 26, 2009 12:45 am
by PB
I think the docs just need that added. It returns 0 if no image can be created:

Code: Select all

Debug CreateImage(0,9999,9999) ; Returns 0
However, I also notice that the debugger returns a runtime error if width or
height is >32000 pixels, which is in contradiction to the docs which state the
max is 8192 for width and height:

Code: Select all

Debug CreateImage(0,99999,99999) ; Compiler message about >32000 pixels

Posted: Sun Apr 26, 2009 12:52 am
by Mistrel
PB, you correctly state that it's an error thrown by the debugger but mention that it's a compiler error in your comment.

Posted: Sun Apr 26, 2009 12:56 am
by PB
No, one returns 0 and one is an error. So only one is an error.

Posted: Sun Apr 26, 2009 1:00 am
by Mistrel
What I mean is that you're using both "debugger error" and "compiler error" in your description. These are contradictory because if it's a compiler error then the debugger is never run.

Posted: Sun Apr 26, 2009 1:08 am
by PB
I don't know. I'm tired. Wait for someone else to contribute.

Posted: Sun Apr 26, 2009 11:14 am
by freak
All object creation functions in PB return 0 on failure.