Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing by Reference
Message
De
22/04/2004 16:58:07
 
 
À
22/04/2004 16:45:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00897358
Message ID:
00897380
Vues:
12
>Thanks for all of your help Al, I already can test another parameter to determine if the parameter in question was passed by reference, I was just curious as to if there was a way to programmatically test the parameter to tell rather than rely on the test result of the other parameter. I guess not.

I don't know of one. I've never had need for that.

A couple of other points:

- if you find a single routine needs to handle values passed by either reference or value, there are a couple of possibilities:

a) You're purposely writing generic code and you know exactly what you're doing and it's as designed
b) The routine started out handling only value or reference and you're extending it to handle both.

If the latter, you should explicitly create a parameter that does nothing except indicate whether the parameter in question was passed by reference. Otherwise, someone else may later pass the other parameter you're currently testing in an unexpected manner that should otherwise work, and you'll have a non-trivial bug to find and fix. IOW you should avoid "overloading" the parameter you're currently testing.

My personal style is to avoid passing by reference; I greatly prefer pure LOCAL parameters and variables. I also tend to avoid arrays so I seldom have to try to pass them; in those cases I'll pass a single parameter object by reference, instead. Parameter objects are handy things if you're not already familiar with them.

How do I return multiple values from a form? FAQ #7810
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform