Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why are my local variables changed?
Message
De
01/09/1999 04:10:08
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
 
 
À
01/09/1999 03:23:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00260036
Message ID:
00260041
Vues:
16
>Take a look at the following program:
>
>PROCEDURE TEST
>	LOCAL cTest
>
>	set udfparms to value
>
>	cTest	= 'Before executing TEST2'
>	? cTest
>	do TEST2 with cTest
>	? cTest
>
>	return
>ENDPROC
>
>PROCEDURE TEST2
>	LPARAMETER cTest2
>
>	cTest2	= cTest2 + ", and now I'm executing TEST2"
>	? cTest2
>
>	return
>ENDPROC
>
>
>Gives the following result when I run TEST from command window:
>Before executing TEST2
>Before executing TEST2, and now I'm executing TEST2
>Before executing TEST2, and now I'm executing TEST2
>
>Why is my local variable in procedure TEST changed? Shuldn't the value be the same when I return from TEST2? Both procedures is in the same prg file and I'm running VFP6 with SP3.
>
>/Mårten Törnquist

From what you see from your program, it seems that SET UDFPARMS only applies to UDFs. Your parameter is passed by value, hence the changes. If you force pass by value, it seems ok.
e.g.
do TEST2 with (cTest)

Interesting behaviour.
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform