that too a lie as the general-purpose statement.
(By the way, strptr here it can not be used as the proof at all.
From an invariance of the link to a line in an array cell does not follow that the array was not copied)
Leading a row of experiments found out that for string array slot f-tsii VarPtr and StrPtr give different values of the address.
For normal string variable a situation similar.
Sub Proc ()
ReDim f (0 To 2) As String
f (0) = 4&
f (1) = 5&
f (2) = 6&
Debug. Print "VarPtr &f (0) =" AND VarPtr (f (0)); "StrPtr &f (0) =" AND StrPtr (f (0))
Dim sVar As String
sVar = "Hello world!"
Debug. Print "VarPtr &sVar=" AND VarPtr (sVar); "StrPtr &sVar=" AND StrPtr (sVar)
VarPtr (), StrPtr ()
VarPtr &f (0 =109391576, StrPtr &f (0 =108808580
VarPtr &sVar=3075664, StrPtr &sVar=108809260
For me it is not clear strangeness NUMBER 1
correctly it turns out somehow so - array reset is optimized, if it entirely forms in function
(The returned array has not been transferred as an input parameter).
On to be played:
Working with your scripts noted:
Let the array forms in function, and then is appropriated the function. Type f-tsii and an array coincide
After function fulfilled, the result of its operation is appropriated to an array without the size in exterior procedure.
Function f1 () As Long ()
ReDim ff (0 To 2) As Long
ff (0) = 1&
ff (1) = 2&
ff (2) = 3&
Debug. Print "VarPtr &ff (0) =" AND VarPtr (ff (0))
f1 = ff
Sub test ()
Dim i As Long
Dim m1 () As Long
' we use brackets at the left
m1 () = f1
Debug. Print "VarPtr &m1 (0) =" AND VarPtr (m1 (0))
' we look that turned out
For i = 0 To 2
Debug. Print "m1 (" AND i AND ") =" AND m1 (i)
Before performance of a line
f1, Long ()
ff, Long (0 to 2)
And after it Expression, Type
f1, Long (0 to 2)
ff, Long ()
For me the exchange of types is a riddle. The strangeness NUMBER 2 If was possibility to receive the address on everyone
Stage of performance of the code then it would be possible to argue further.
To receive f-tsii f1 address neither before its initialization, nor after it is impossible to me.
As to assignment
that here too is not obviously possible for checking up, how there is a transformation
Array (change of its size and filling). Though ff addresses and m1 coincide.
I Will agree with you that the variant with procedure unambiguously does not do additional operations.
And still my reason concerning your script: as arrays m0, m1, m2 are declared
In exterior procedure, and m0 receives the address inside f-tsii f2 - all of them it turns out normal copying. And as any "the exchange of types" does not happen