Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug in VFP9?
Message
From
29/03/2019 05:53:32
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01667575
Message ID:
01667671
Views:
61
Likes (1)
>I have related question. I think I recall that calling someFunction(@tcLongString) is quicker than someFunction(tcString) if we don't make any changes with tcString inside the function.
>
>Do I remember correctly and it's indeed better to use first syntax?
>
>Thanks in advance.

When you pass by reference (using @tcLongString) syntax, any code references made to the string result in the local value (from the caller) being updated as well.
* Example without by reference calling:
lcString = "Hi, mom!"
? "Before: " + lcString
test_function(@lcString)
? "After: " + lcString

? "-----"

lcString = "Hi, mom!"
? "Before: " + lcString
test_function(lcString)
? "After: " + lcString


FUNCTION test_function
LPARAMETERS tcString
tcString = CHRTRAN(tcString, "m", "-")
Previous
Reply
Map
View

Click here to load this message in the networking platform