+= on associative arrays leads to surprising result
anonymous at example.com
Tue Aug 27 16:37:23 UTC 2019
On 27.08.19 18:12, berni wrote:
>> import std.stdio;
>> void main()
>> real[int] a;
>> a += 100;
> results (independed of the used compiler) in
> I was a little bit surprised, because a += 100 should be the same as
> a = a+100, which leads to a range violation error. Furthermore, as
> we work with real, I'd expected the result to be NaN...
> Is this a bug? I ask, because it would be quite convenient to use it the
> way it works now.
For what it's worth, it's in Bugzilla:
More information about the Digitalmars-d-learn