Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Private Global Variable
Message
De
17/06/2002 14:15:30
 
 
À
17/06/2002 09:45:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00669192
Message ID:
00669362
Vues:
13
Isn't that already pretty much a standard? I agree, we prefix our global variable with 'g' now.

Tracy

>This text was already posted some days ago under 'Coding, Syntax & Commands', but it didn't get much attention over there. I'll try it here once more.
>***********************************************
>
>Hi to all,
>
>After having had a nice conversation with JimB (Re: Public variables Thread #667392 Message #668939) I'd like to propose to the community to use g as scope indicator for variables that are declared public OR PRIVATE in the MAIN program. The g then indicates that it are GLOBAL variables. Global (g) is then simply an indicator that they're visible to the entire application. Here's an example of a main program.
>
>*	Declare GLOBAL variables. Notice that I use the g here for PRIVATE variables.
>*	The g indicates that these variables are visible/global to the entire application.
>*	The only place where private variables are allowed to start with a g is in the main program.
>*	This usage of g is different from what's proposed in the vfp-documentation (where it's
>*	advised for public variables).
>private goMainWindow, goNewActivity, goReports, goOptions
>
>*	References to forms.
>store null to goMainWindow, goNewActivity, goReports, goOptions
>
>do form MainWindow name goMainWindow
>
>read events
>
>release all like g*
>*	The ALL LIKE wouldn't work for public variables.
>*	However, it's not even a necessary statement, for these variables
>*	will go out of scope anyway on return.
>
>RETURN
>
>Feedback please.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform