Page 1 of 1
Questions about passing parameters
Posted: Thu Jul 15, 2004 9:11 am
by Stefke28
Dear Support
1. How are passed the parameters standard in PureBASIC?
2. How do I give byref through in pure basic ?
3. How can I get the memory address to an pointer in PureBASIC ?
Thanks for your answer before
Stephane
Posted: Thu Jul 15, 2004 10:06 am
by thefool
3. How can I get the memory address to an pointer in PureBASIC ?
You put @ in the front of it.
from the manual:
To find the address of a variable in your code, you use the at symbol (@).
Why dont you go read the manual. Most of your questions is in there.
Posted: Thu Jul 15, 2004 10:55 am
by Stefke28
And what about the questions 1 and 2 ?
Thanks
Stephane
Posted: Thu Jul 15, 2004 11:47 am
by GedB
In purebasic paramaters are always passed by value, on the stack in the standard c manner.
Pointer are dealt with explicitly, and the langauge does not attempt to obscure them from you through syntax.
When you pass a pointer to a structure, you are passing a pointer to a structure, the address at which that structure is held, which is a long. There is none of this obfuscating ByRef nonsense.
Posted: Mon Apr 11, 2005 6:02 am
by akee
i was asking the same question about ByRef and searched the forums... anyway some experimenting yielded this result.
Code: Select all
Procedure morph(*varbyref)
PokeS(*varbyref, "outside has been changed")
EndProcedure
outside.s = "ok"
Debug outside
morph(@outside)
Debug outside
Posted: Mon Apr 11, 2005 5:23 pm
by blueznl
Posted: Mon Apr 11, 2005 5:41 pm
by GedB
akee,
Be careful poking those strings
Code: Select all
Procedure morph(*varbyref)
PokeS(*varbyref, "outside has been changed")
EndProcedure
outside.s = "ok"
after.s = "not ok"
Debug outside
Debug after
morph(@outside)
Debug outside
Debug after