Page 1 of 1

Pointer issue [solved]

Posted: Sat May 25, 2024 12:49 pm
by kingwolf71
I am mostly a PB user and I use Spiderbasic due to its similarity
but this code doesn't work on Spiderbasic even though it runs

Code: Select all


Procedure   Test(*var.integer)
   *var\i = 7
   
EndProcedure


a.i = 5
Test(@a)
debug a

On PB the result is 7 while on SpiderBasic it is 5.
can someone explain please?

EDIT after @Fred pointer-ed me in the right direction

Code: Select all

Structure stFlag
   i.i
EndStructure


Procedure   Test(*var.stFlag)
   *var\i = 7
EndProcedure


a.stFlag\i = 5
Test(@a)
Debug a\i


Re: Pointer issue

Posted: Sat May 25, 2024 1:25 pm
by Fred
In spiderbasic, you need to use the structure as well for your variable, native type can't be aliased like it's done on PureBasic