Fabio,
>Why you have skip the last point ?
You mean the code you posted showing that calling DOEVENTS takes 0 time?
I didn't respond to that because it's physically impossible. Executing a line of code in VFP always takes time. Executing a line of code in
any computer language always takes time. Even a NOP instruction takes time. Your "test" code is simply incapable of measuring the amount of time it takes.
For you to think that executing a line of code takes 0 time pretty much explains the futility of trying to convince you otherwise.
If a 0 time instruction were possible, and generate a useful result, then a 0 hz computer could operate as fast as a 2.4 ghz computer. Intel, IBM and Motorola would be out of business and we'd all have infinitely small computers with infinite computation capacity.
VFP
does not do things like invariant code hoisting or loop unrolling that C/C++ optimizers are capable of. If a C++ compiler had determined that your DOEVENTS call was invariant,
which it is not, but it could
wrongly assume this it would have emitted code like this:
tzz = seconds()
doevents
i = 1100001
? seconds() - tzz
completely eliminating the loop, and making it run much faster.
These optimizations can in some cases be quite incorrect and are the reasons for #PRAGMAs to exist to turn them off, because C/C++ compilers are not the all-knowing things that they sometimes think they are.