Nothrow, pure in druntime
Michel Fortin
michel.fortin at michelf.com
Mon Jan 26 20:09:32 PST 2009
On 2009-01-26 14:21:18 -0500, Walter Bright <newshound1 at digitalmars.com> 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
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list