Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Private Global Variable
Message
 
 
À
17/06/2002 09:45:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00669192
Message ID:
00669364
Vues:
14
The only global variable I use in my application is oApp. I don't see any reason to prefix it with additional 'g'.

>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.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform