On 06/01/12 1:01 PM, Fred Cisin wrote:
On Fri, 6 Jan 2012, Toby Thain wrote:
The long version isn't less efficient.
Actually, it is, or at least may be, depending on the compiler;
gcc compiles to the
same assembly, which is what I meant by "not less
efficient".
I expect most popular compilers would do the same.
First, THANK YOU, for taking the time to check that out.
If you will recall, I said, UNLESS THE COMPILER OPTIMIZES.
I must have missed that part, sorry.
Replacing your^H^H^H^H MY code with something
"equivalent", but presumably
"better" is called OPTIMIZATION, and that is what happened, and why the
code produced identical results.
In this case, it is a correct and appropriate optimization.
Yes, I'm aware.
--T
Sometimes it isn't. Some early optimizing
compilers created
complications (not with THIS, but with polling loops, etc.). But, in this
case, the optimization is completely correct.
...
--
Grumpy Ol' Fred cisin at
xenosoft.com