Bload tiny detail about "no graphics screen was set"

Forum for discussion about the documentation project.
Tourist Trap
Posts: 2356
Joined: Jun 02, 2015 16:24

Bload tiny detail about "no graphics screen was set"

Postby Tourist Trap » Mar 01, 2017 15:39

Hello,

it's really not a big thing, but as usual when playing with images I had a crash for forgetting the screenres call at image creation.
It beeped at BLOAD function call in my case recently so I've been to the BLOAD doc page. It's very well done with most frequent reasons of run-time failure. Just I found the exposure of the case not well separated enough.

It's like that:
Runtime errors:
BLoad throws one of the following runtime errors:

(1) Illegal function call

dest was not specified or was null (0), and no graphics screen was set.

I don't know if it's better rendered and still true with something like that:
Runtime errors:
BLoad throws one of the following runtime errors:

(1) Illegal function call

no graphics screen was set at image creation time
dest was not specified or was null (0), (and?? no graphics screen was set).

The most current cause of failure is in my mind explained by the first sentence, that's why I'm thinking of it. But I don't know exactly what the second sentence mean. Does this mean that BLOAD won't crash if the dest is NULL and a graphics screen is set?

Not a big issue, just clarification of a usual case, thanks.
counting_pine
Site Admin
Posts: 5929
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Bload tiny detail about "no graphics screen was set"

Postby counting_pine » Mar 01, 2017 19:08

Passing 0 as the dest or leaving it blank, outputs to the screen buffer. So it won't crash if a screen is set.
But I guess the burden here is on the programmer to make sure creating an image doesn't silently fail. Because passing an image that failed to create shouldn't generally output to the screen.
Tourist Trap
Posts: 2356
Joined: Jun 02, 2015 16:24

Re: Bload tiny detail about "no graphics screen was set"

Postby Tourist Trap » Mar 02, 2017 13:50

counting_pine wrote:Passing 0 as the dest or leaving it blank, outputs to the screen buffer. So it won't crash if a screen is set.
But I guess the burden here is on the programmer to make sure creating an image doesn't silently fail. Because passing an image that failed to create shouldn't generally output to the screen.

Yes, I think you're right. In my opinion, in order to output to the screen it would be better to use -1:

Code: Select all

BLOAD file, -1

That would remove any risk of confusion with a pathologic null pointer in BLOAD file, imgPtr=0 --> beep.

Return to “Documentation”

Who is online

Users browsing this forum: No registered users and 1 guest