Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why define constants
Message
 
 
To
25/10/2006 10:03:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01164235
Message ID:
01164385
Views:
9
Jim,

>Interesting... I expected your main criticism to be repeated code if used in more than 1 place.

There would be that too if you set those variables in more than one place. That destroys code maintainability.

>Personally, in these days of large RAM I have little concern for memvar consumption.

memvar consumption != memory consumption. VFP is still limited by MVCOUNT, which is someone is already running near the limit and they call into some blackbox Word automation code you've created their app can crash.

>And my suspicion is that execution speed would be little different between the two because I assume that any "constants" actually end up in (what we called in mainframe days) the "literal pool", resulting in similar execution as using a memvar. And, again, today's processors are so fast that I concentrate speed issues primarily on external data access/update and not on internal memory fetching.

Using memvars you make the end user spend the CPU cycles every execution of that code. #defines make only one CPU hit and that's on the programmers machine at compile time.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform