Omer Zak wrote:
1. How do you ensure that the compiler did not optimize away the
assignment to q or the call to sqrt() due to recognition that it has no
side-effects (in 80x86 processors, there is a FP sqrt instruction so a
serious compiler knows to inline the function call and that it leaves no
side effects)?
2. Why not use q += sqrt(i) in the benchmark (solves the above problems
without special compiler options or obscure pragmas)?
While we're at it, let's also print out the result, to avoid a case
where the compiler notices that q is never used.
Shachar
--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
http://www.lingnu.com/
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]