Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AND and OR evaluations in conditional statements
Message
De
13/04/1999 12:14:00
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00206066
Message ID:
00207846
Vues:
19
David,

So WHY do you attribute this to "the optimizer", that is the question?

I also stated in my reply that we are told in virtually ALL programming languages to 'self-optimize' logical statements to avoid extra (and unnecessary) processing.

*IF* VFP indeed has an "optimizer" for logical statements, this would be the first that I have EVER heard of it! As you have done, some may speculate that that is the case.

There is absolute no way that your assertion that " This is a completely false statement " is borne out by your example as virtually every language would perform in the same way. Yes, some might do a complete syntactical check of a whole statement before executing it, and some may even perform complete operand type-compatibility checks before executing the statement. We know that FP/VFP *previously* did not check for these things because we could have a syntax error or even a type conflict which went undetected *UNTIL* a case arose where the (further along) part of the statement actually got interpreted/executed. This has been reported as fixed for some time now, so if anything VFP is now less 'optimized' than it used to be.

Jim N

>Jim,
>
>> This "proves" that the so-called VFP 'optimization' is a figment of the imagination
>
>This is a completely false statement. If you use function calls in place of memvars in the logical expression, you will in fact be able to trace the execution and see that VFP will do it's own optimization. I'd point you back at the code I posted earlier in the thread as a starting point. The expression in that code was purposely constructed to be non-optimizeable to show that VFP correctly understood the operatir precedence. If you run ? t1() or t2() and trace it the t2() function WILL NOT BE CALLED, the optimizer knows that calling it can not change the end result, so it doesn't call it.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform