Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Gotcha of the day
Message
De
26/11/1999 11:37:27
 
 
À
26/11/1999 11:33:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00295644
Message ID:
00295776
Vues:
16
>>>Specify an include file for the form that has READONLY defined
>>>as a compile-time constant. eg #DEFINE READONLY -1
>>
>>You can hose yourself in plenty of different ways by being careless about the names that you give Compile time constants. Any time you create a constant with the same name as a VFP keyword, oyu run the risk of your constant value being used instead of the keyword when your code is compiled.
>>
>>Lesson? DON'T USE VFP KEYWORDS as CONSTANTS. (or variables for that matter).
>
>I wish it were that simple. This error will also occur when
>you use a non-keyword constant and an object within the same scope
>has a property with matching name.
>
>#DEFINE foo .T.
>
>THISFORM.foo = 1 &&causes an error
>
>I'm well aware of the fact that using reserved words as variables/arrays/whatever
>will sooner or later get you in trouble. It just happened
>that an include constant I copied form a help file was given
>a name that belongs to VFP keywords.

This is a good argument for sticking with the type of conventions that are used in Foxpro.h- constants are given a prefix that denotes what they pertain to- (messagebox constants all start with MB_) this will make the chances of crossing wires much smaller.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform