Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public variables
Message
De
13/06/2002 16:32:57
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00667392
Message ID:
00668236
Vues:
26
Ria,

You say that A calls B. Later you say that A terminates before B is called. I think the solution depends somewhat on what the flow really is.

If A calls B and if A gets focus again after B has ended, then B is only a subroutine of A. The fact that it's an EXE doesn't matter. It's up to you whether you want to allow this subroutine to use the public OR private variables that were declared in A. Simply test for the existence of one or more of those variables, using vartype(). If the variables already exist, then you might decide to skip the reading of the ini-file.

However, if A ends before B is called, then B isn't a subroutine of A. Instead, they're on the same level. But even then it may be that both A and B are regarded as subroutines of an even higher (virtual?) routine. And I don't regard it as wrong to declare variables public in the first called routine (when they do not yet exist) and then skip their declaration in the secondly called routine (after they were proven to already exist).

Don't worry about it too much. Make sure your code is bullet proof. So, either test for their existence or declare them anyway. But whatever you decide... DOCUMENT IT!!!!!

Peter

>Hi,
>
>Isn't it a good practice to release all variables used before the program is terminated?
>
>I have a situation like this:
>
>- A.exe calls B.exe
>- A set of public variables are defined in A.exe . They are assigned values from
>an INI file. These variables are used in the program to define the location
>of data etc.
>- A.exe does not release the memory variables.
>- B.exe also needs all the public variables defined in A.exe.
>
>Will it be better not to release the public variabled defined by A.exe so that
>they need not be redefined in B.exe and use them again in B.exe
>
>or
>
>would it be better to release all variables before terminating A.exe and
>redefine all ht public variables and then read
>the INI file and assign values to the public variablesin B.exe.
>
>The INI file to be used is passed as a parameter to A.exe & B.exe and
>it changes based on where the program is executed.
>
>
>Ria
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform