Movement against float.init being nan
IGotD-
nise at nise.com
Sun Aug 21 20:25:19 UTC 2022
On Sunday, 21 August 2022 at 19:57:52 UTC, apz28 wrote:
>
> Price for this float=NaN & char=FF
> 1. Runtime bloat -> all struct/class with (float or char) need
> special initializer
> 2. Slow -> all struct/class not able to utilize zero
> initialized from memory manager
> 3. Inconsistent with other value types (all zero bits)
> 4. Aggregated/Sum float var should start with zero
>
> So -> Better error when var is not initialized than this
> special value
These are very good points which I agree with. Previously I was a
bit it didn't matter for me (either Nan or 0.0) but with these my
mind tipped over in favor of zero for both char and floats. It is
a better design because of the consistency as well it enables the
optimizer to use large moves in order to initialize the memory.
However, will it be the real use case after optimizing away
unused values, that is the question.
More information about the Digitalmars-d
mailing list