Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug in VFP9?
Message
De
29/03/2019 13:26:42
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01667575
Message ID:
01667723
Vues:
53
>>>Hi,
>>>
>>>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.
>>
>>Regardless of whether it's marginally faster or not, it's a bad idea. Functions should not have side effects. They should do their calculations and return a value. Calling a function with a parameter by reference is asking for a side effect. It's also setting you up for trouble down the road when something inside the function changes and suddenly tcLongStrong gets changed.
>>
>>Tamar
>
>Hi Tamar,
>
>The strings can be really long (although normally they aren't). I'm sending that string into Parse method which parses it and returns requested tag. This is called many times in our classes and since I know the behavior of that particular method, I think I'm safe here and passing them my reference may be actually a benefit in terms of speed.

Then, my advice is to document what you're doing, why you're doing it, and how it could break.

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform