Page 1 of 1
Structures as return values for procedures
Posted: Sat Sep 25, 2010 2:01 pm
by blueznl
Code below says it all...
Code: Select all
Structure xx
a.i
b.i
EndStructure
;
Procedure.xx pfew()
Protected q.xx
q\a = 1
q\b = 2
ProcedureReturn q
EndProcedure
Global z.xx
z = pfew()
Debug z\a
Debug z\b
Re: Structures as return values for procedures
Posted: Sat Sep 25, 2010 2:15 pm
by STARGÅTE
Re: Structures as return values for procedures
Posted: Sat Sep 25, 2010 6:55 pm
by blueznl
Well, in that case see it as a reminder

Using pointers is soooooo 1970's...
Re: Structures as return values for procedures
Posted: Sat Sep 25, 2010 7:00 pm
by ts-soft
blueznl wrote:Using pointers is soooooo 1970's...
Basic in the 70's doesn't support pointers. Pointer comes later in modern Basic's

Re: Structures as return values for procedures
Posted: Sat Sep 25, 2010 7:07 pm
by STARGÅTE
@blueznl: That's your opinion!
A procedure to pass a pointer, in which it can write directly inside, is faster than if the entire structure (with Longs, Strings, Lists, etc.) are copied to each return from the procedure in the variable, like CopyStructure().
EDIT:
But I agree with you!
It would make some things "simpler".
and it's not forced to use it.
Thus, you can always use pointers if you need more speed.