Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Constants vs Locals
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00269906
Message ID:
00270098
Vues:
24
>>There is a performance increase using a named constant. It's not evaluated at run-time. See message#268676. George Tasker came up with a test that shows this.
>
>
>Yes, this is kind of related to that thread about defining SYS() functions and other similar things, something that I would usually use a local for if only needed in one method, but now I'm wondering if a constant might be better. If it weren't for that debugger problem...

I know, dejavu. If you have 'Code complete' by Steve McConnell he spends about 5-6 pages discussing named constants and how to use them.

I think if used properly the debugger issue is not much of a problem. One of our goals should be 'information hiding' ie. Hide all those (to us) meaningless numbers behind something we understand. The messagebox constants are a perfect example.

In 'Code complete' Mr. McConnell writes that we should avoid all literals (with the exception of 0 and 1). They should be replaced with named contants.
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform