dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead

FeepingCreature feepingcreature at gmail.com
Fri Nov 5 11:44:42 UTC 2021


On Friday, 5 November 2021 at 10:08:30 UTC, Ola Fosheim Grøstad 
wrote:
> On Friday, 5 November 2021 at 06:30:02 UTC, FeepingCreature 
> wrote:
>> I think the program should crash in all these cases. The text 
>> editor should crash. The browser should crash. The analyzer 
>> should see a NaN, and crash.
>
> No, NaN is completely different. You have two types of NaN, one 
> is for signalling that data is missing in a dataset (received 
> from the outside). The other is to convey that a computation 
> failed (often caused by roundoff errors).
>
> To remove NaN from floating point is unworkable in the general 
> case.

When I have to do numeric work and suspect NaNs in play, I like 
to `feenableexcept(FE_INVALID)`. Then every time a NaN arises in 
a computation, I get a nice SIGFPE.


More information about the Digitalmars-d mailing list