IceSoft wrote:
Please explain me this:
I get a syntax check error with 5.10 when I write:
correct is
Thats is ok...
Right, because typed pointers don't make sense, it only makes sense if the type refers to the target memory.
IceSoft wrote:
but with this one i got an Syntax check error
Code: Select all
Procedure.Integer test()
a.i
ProcedureReturn a
EndProcedure
Yes, because Integer is not the same as ".i". Integer is a structured type, not a plain data type.
IceSoft wrote:
and last but not least explain me the return value behavior of this but functions:
Code: Select all
Procedure testvalue()
a.integer
ProcedureReturn a
EndProcedure
Procedure.i testpointer()
*a.integer
ProcedureReturn *a
EndProcedure
Debug testvalue()
Debug testpointer()
The first procedure returns the address of the structured variable 'a'. Because that variable is placed on the stack,
it will be dropped after returning from the procedure, i.e. the pointer is useless because the variable doesn't exist anymore.
If you write ProcedureReturn a\i you will get the actual "plain data" value.
The second procedure returns a pointer to an Integer structure.
If you use allocate memory inside the procedure you can create a memory block which is still valid after
returning from the procedure. Since PB uses implicit type casting, it will cast the address to an integer
which is technically the same (since both are regular integer values of the same size).
I said it's no bug...that doesn't mean I don't agree on sometimes inconsistent syntax and missing features
which are essential in
my opinion.