GENSPRITE() crash

Previous topic - Next topic

FutureCow

Here's a one line program that crashes on WinXP

Code (glbasic) Select
GLOBAL MouseSpriteId=GENSPRITE()
That's the format the example in the manual uses for the GENSPRITE command.

If on the other hand I get rid of the GLOBAL statement as follows
Code (glbasic) Select
MouseSpriteId=GENSPRITE()

or

GLOBAL MouseSpriteId
MouseSpriteId=GENSPRITE()

it no longer crashes.

MrTAToad

RGB is the only command that you can use to initialise a variable.

However, the compiler (gpc) certainly shouldn't crash :)

FutureCow

The compiler doesn't crash, it passes through the compiler and crashes as an .exe

MrTAToad

Mine crashed the compiler...

FutureCow


MrTAToad

Its probably the better choice :)

MrTAToad

It doesn't crash the compiler now - just the executable.

FutureCow

QuoteRGB is the only command that you can use to initialise a variable

As a matter of interest, does it say that in the doco somewhere? I must have overlooked it.

Hemlos

Quote from: FutureCow on 2009-Oct-04
Here's a one line program that crashes on WinXP

Youre right, this happened to me also...one time, the first time i tried the same thing by declaring global.
I tested it again, and the exe next crashed.
And every test after, the compile doesnt crash, just the exe.
Bing ChatGpt is pretty smart :O

MrTAToad

QuoteAs a matter of interest, does it say that in the doco somewhere? I must have overlooked it.
It's not in the documents per se (except for my  online documentation)  but if you look in log_e.gbas, V6.247 does state : RGB works for GLOBAL assignments.

Hemlos

Quote from: MrTAToad link=topic=3598.msg26395#msg26395  V6.247 does state : RGB works for GLOBAL assignments.
/quote]

Thats means, "It is working now, and it wasnt previously".
It doesnt mean its the only one used with global.
You should declare every value, global or local, or local global.
And this is the reason i tried to GLOBAL a=gensprite()
Bing ChatGpt is pretty smart :O

MrTAToad


Hemlos

I see what you mean now.

What i meant is this:

GLOBAL a,b,c,d,e,f
a=0
b=142346
c=RGB(blahblahblah)
d=GENSPRITE()

Bing ChatGpt is pretty smart :O

MrTAToad

If its not a constant value or RGB, then it wont be allowed :)

Kitty Hello

Background: The global vaiables with initial values are initialized _before_ the main engine initializes. Thus, many of the functions will not work because the framework is not ready, yet.