Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
#DEFINE - Why?
Message
From
31/03/2008 10:05:10
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01306848
Message ID:
01306930
Views:
8
>>>>>>What is the simplest explanation as to why these are needed? Why not just set regular variable values? So what if they are constant and don't change?
>>>>>
>>>>>In addition to Hilmar's reply - all define variables would be substituted with their values in compilation time, e.g. the code would actually read 5 instead of SOMENUMBER every time where SOMENUMBER is used.
>>>>
>>>>But, from a practical standpoint, does that really matter? I haven't heard anything yet that is convincing that these are really needed or make much of a difference.
>>>
>>>Using variables = using memory
>>>Using DEFINES - no impact on memory
>>
>>Is this an issue really?
>
>It all depends on the number of the constans you'd like to use.
>
>I prefer "mixed" style, my former colleague Mike Asherman was a big favorite of DEFINEs and his code style influenced me quite a lot when I was just starting working with VFP.
>
>BTW, there are pre-processor directives in C# as well. If like #IF and #REGION so far, haven't figured out and used others yet.
__
There's also #define. But it seems to be more restricted than foxpro
#define SOMETHING

#if SOMETHING
  ...
#endif

What it does not have is

#define MYCONSTANT   77
For the others ... http://msdn2.microsoft.com/en-us/library/ed8yd1ha(VS.71).aspx
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform