"When passing large strings to a function, ByRef enhances performance and conserves memory by avoiding the need to make a copy of the string."
My extremely limited understanding of memory had me thinking that if you don't use ByRef when the data is passed to the function, a copy is made and that copy is stored in a new memory address and when ByRef is used it uses the memory address of the data that was passed.
I did the following test
Code: Select all
x := ["apples","oranges"]
MsgBox, % &x ; show memory location of x
addo(x)
ExitApp
addo(byref h){
MsgBox, % &h ; show memory location of h
}
; results, regardless if ByRef is used, the memory addresses of x and h are the same. When tested with a simple variable (not an array) the addresses where different when ByRef was omitted
What am I missing?
Thank You