Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why define constants
Message
From
25/10/2006 11:50:25
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01164235
Message ID:
01164432
Views:
10
>>>>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.
>>>
>>>Not so. They are preprocessed by the compiler, replacing the constants in the code. They are not saved as memvars at all. It goes within the code space as it is just code.
>>>
>>>What you see in your code as "wdForward" is actually written internally in pre-compile time as "1073741823" in the example.
>>
>>Why are you so sure that "1073741823" is actually *IN* the generated code that is the code executed... have you seen VFP's internals to see how it actually does this?
>>
>>In mainframe assembler I might code ' MVC SomeArea, "Not in use" ' and just because the "Not in use" is coded *IN* the instruction itself doesn't mean that it was actually in-line *IN* the code. In fact the "Not in use" was moved by the compiler into the "literal pool" and the actual computer instruction referred to the location in the literal pool. Which effectively made it no different than using a variable, in terms of execution speed.
>>My **guess** is that VFP would be no different. Of course there's a fifty-fifty chance (at least) that I'm wrong.
>
>Sorry for you Jim, but you are 100% wrong. <g>

OK. Just tell me how you know that.

Surely you're not relying on a DISPLAY MEMORY command output as the "proof"?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform