[off topic]
Lost Zergling wrote:The purpose of swap in this context (in my mind) is to make a local variable "virtually static" in memory so as to minimize stack calls and/or backend dealloc/realloc. I see it as if using stack was a little bit like using processor cache...partially thrue I think
Swap just does, what it is expected to do (no more, no less):
Swap var_type1, var_type2 (var_type(n) means: any FB intrinsic data-type)
the values held by any var_type(n) are simply exchanged ...
result = var_type1 has now the value, previously held by var_type2 (and, vice-versa).
Code: Select all
Dim As String s1 = "a", s2 = "z"
Dim As Long l1 = 123456, l2 = -654321
Print s1; " "; s2
Print l1; " "; l2
Sleep
Swap s1, s2 : Swap l1, l2
Print s1; " "; s2
Print l1; " "; l2
Sleep
[/off topic]