float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

jmh530 john.michael.hall at gmail.com
Wed Jun 30 10:38:05 UTC 2021


On Wednesday, 30 June 2021 at 04:17:19 UTC, someone wrote:
> On Wednesday, 30 June 2021 at 03:55:05 UTC, Vladimir Panteleev 
> wrote:
>
>> If you want to give any type a "null" value, you could use
> [`std.typecons.Nullable`](https://dlang.org/library/std/typecons/nullable.html).
>
> At LEAST for some things with currency types like prices which 
> cannot be zero because 0 makes no sense for a price:
> [snip]

You've never given something away for free?


More information about the Digitalmars-d-learn mailing list