Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Opinions sought on declaring variables
Message
De
15/12/1998 19:28:51
 
 
À
15/12/1998 09:35:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00167644
Message ID:
00167885
Vues:
22
All my variables are declared at the top of the func/proc/method. The performance gain of declaring them where needed is too small and the gain of having all variables declared up front is too big. :)

From experience I've learned that variables declared "somewhere" are one of the most important source of bugs when working in a team or during code maintenance.

I don't initialize variables at top if they don't have to have a default value.

The same goes for my C/C++ code (IMO, the problems generated by variable declarations anywhere in code are even more "sweeter" in C++ :)).

Vlad

>Ok all - poll of the day:
>
>Do you declare (LOCAL, etc.) all your variables "up front" in each method/prg or do you declare them only when they're about to be used first time within the method/prg as in the case of conditional branching where the variable may not be used at all except under a particular case?
>
>I've seen use of and arguments for both. Just like to see what everyone is doing. Also how do all of you feel about the practice of always giving a local variable a default value up front or wherever it is declared?
>
>TIA!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform