Movement against float.init being nan
Steven Schveighoffer
schveiguy at gmail.com
Fri Aug 26 16:22:40 UTC 2022
On 8/25/22 8:14 PM, ryuukk_ wrote:
> On Thursday, 25 August 2022 at 03:08:54 UTC, Steven Schveighoffer wrote:
>> A better option would be to throw an exception if NaN is used in an
>> operation.
>
>
> How to kill a language, put exceptions everywhere, specially in math
> operations
>
> https://pspdfkit.com/blog/2020/performance-overhead-of-exceptions-in-cpp/
>
> I hope you were joking
I'm not asking for this, I'm saying without having some sort of "fail
upon use" mechanism (be it a signal or an exception), it's just not
effective at finding initialization problems. What it has going for it
over 0 is that it's definitively a problem *if you happen to see it*.
But you have to look for it, and finding the source can be long gone by
the time you see it.
Think about null pointers -- they cost nothing but explode as soon as
you try to use them. Exactly the correct mechanism, and it should happen
close to where it was initialized.
-Steve
More information about the Digitalmars-d
mailing list