Code: Select all
dim titi as any Ptr
dim toto as string Ptr
dim tutu(1) as string
tutu(0) ="T0"
tutu(1) ="T1"
toto=@tutu(0)
Print *toto
Swap titi, toto
Print *CPtr( string Ptr, titi)
titi+=SizeOf(String) 'Parsing a string Ptr using any Ptr
toto=titi
Print *toto ' Can't use any Ptr to access value
' titi=CPtr( string Ptr, titi) ' has no effect : Any remains byte Ptr
' Print *titi ' => Incomplete type,..
Print *CPtr( string Ptr, titi) ' need to specify datatype when accessing
sleep
system
Code: Select all
'Pointer is adapted to parsed the datatype
Property ArrayExtension.aStep As Byte
Select Case As Const Datatype
Case 1 : Str_StepPtr+=INT_StepCursor : Return 1
Case 2 : Int_StepPtr+=INT_StepCursor : Return 1
Case 3 : Dbl_StepPtr+=INT_StepCursor : Return 1
End Select
Return 1
End Property
'OR
'In the situation below, no Select Case As Const, but pointer As Any is working at ubyte level
Property ArrayExtension.aStep As Byte
ANY_StepPtr+=INT_StepCursor ' Compare to above INT_StepCursor is presiously set to INT_StepCursor*SizeOf(Datatype)
Return 1
End Property