Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AND and OR evaluations in conditional statements
Message
 
 
À
14/04/1999 07:05:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00206066
Message ID:
00208189
Vues:
21
Jim,

I'm sorry the definition I learned of what an optimizing compiler is doesn't agree with yours. I think we can just be grateful that most compilers in use now are capable of this basic level of optimization. The first couple of Fortran compilers I used did not. I was quite pleased that Fortran-77 implemented this optimization back in the early 80s. It would seem most compiler designers learned well from the likes of Aho and Holub. If you choose to not call this short-circuiting of evaluation something other than optimization, you are free to call it whatever you want. I might suggest "Fred" as a good alternate name. *s*

It's also not necessarily as ridiculous as you assume it is for a full logical expression to be evaluated. Especially where function calls are involved and those functions have side effects beyond the boolean value they return (and I don't want to start an argument on the goodness/badness of functions like this).

I never once, anywhere, have said CASE are evaluated beyond the first one that returns a .t. DO CASE is a program flow control structure, not particularly related to the current discussion, beyond the fact that short-circuiting is also used during the evaluation of the logical expression within the CASE satements. I don't know why you try and cloud the issue with a tangent like this.

I have given this a lot of thought. I have studied two compiler theory books in the last 24 years. I written a few language parsers and expression evaluator functions. I am more than a little bit familiar with the topic. I am also again wondering about the usefullness of the time I keep spending writing these replies to you in threads like this.

>Come on now...it would be ridiculous for VFP or any other language to continue beyond the OR! This is *not* optimization, it is just the way sensible programming works! Do you think (or expect) that all CASEs of a CASE structure are evaluated beyond the one which 'triggers'? Using your logic most compilers would and those that did not would be credited as having an optimizer!
>
>Give this just a little bit of thought, will you. *Anything* beyond your 'OR', no matter what it is or how long it is or how many parenthesis it might have, cannot affect the result. To call observance of this fact 'optimization' is to look for crediting VFP with something that just isn't so. It *would* be poorly done if it did anything else!
>
>Jim N
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform