Steve Harris wrote:

On Thu, Jun 24, 2004 at 01:10:37 -0300, Juan Linietsky wrote:


inline float FlushToZero( volatile float f )
{
f += 9.8607615E-32f;
return f - 9.8607615E-32f;
}


That actually looks nice... since thanks to writing "volatile float f",
the optimizer should not touch it.. it' the same thing than
when one accsses directly to the harware using pointers
to memmaped registers.. lack of using "volatile" often
ends up in non-working code..



Ah, yes, I guess volatile should mean that. Hmmm...

The reason its an inline function rather than a drop-in replacement
macro is because casting macro arguments to volatile wasn't having
the desired effect on the optimiser, whereas this does.

Simon Jenkins
(Bristol, UK)




Reply via email to