On 2009-01-26 14:21:18 -0500, Walter Bright <[email protected]> said:

I guess it's reasonable to argue that using the floating-point flags is sufficiently hard-core that pure and nothrow should pretend that they don't exist.

Still, some functions (especially correctly-rounded floating-point i/o) go to a lot of trouble to support them. I have a suspicion that it's not worth the effort.

So we have two options. One is to say that floating point arithmetic cannot be made pure. The other is to ignore the problem (saying it's undefined behavior).

I see another: the compiler keeps track of the state of floating point flags inside a function, and prevent pure optimisations across those boundaries. Of course, the language would have to expose a mean to change these flags in order for it to work... and prevent any such change from leaking after the lifetime of a function.

--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to