Floating point types default to NaN?
Adam D. Ruppe
destructionator at gmail.com
Mon Nov 27 17:05:12 UTC 2017
On Monday, 27 November 2017 at 14:58:42 UTC, Steven Schveighoffer
wrote:
> I rely on the default value initialization all the time! I
> don't know how that would jive with structs, since they are
> technically local variables, but usually are valid without
> initialization.
Yes, indeed, me too. I like it now.
But there might be a compromise that is still workable: let
structs and ints (and bytes, short, etc) be exceptions and not
issue an error there. But then conservatively check other types.
If the compiler sees any read before any write, issue the error.
Otherwise, keep the status quo.
That's fit the spec and catch real bugs more often than false
positives.
Though, I'm in no ruse to see that implemented either, overall I
am meh on it.
> What about AAs? Would you have to do = []?
they could be an exception too, but you could do = null (= []
won't pass the type check lol)
More information about the Digitalmars-d-learn
mailing list