Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 18, 2016 [Issue 4463] [AA] double.init in associative array seems 0.0 | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=4463 MichaelZ <dlang.org@bregalad.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dlang.org@bregalad.de --- Comment #2 from MichaelZ <dlang.org@bregalad.de> --- @hsteoh: I don't believe it is related to 3825; 3825 has been apparently fixed (for d2) in 2013 (q.v.), but the behaviour described by bearophile_hugs is still present in dmd 2.071.0 :-| -- |
August 18, 2016 [Issue 4463] [AA] double.init in associative array seems 0.0 | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=4463 --- Comment #3 from MichaelZ <dlang.org@bregalad.de> --- ... having said that, the double behaviour is explicitly brought up in the pull request discussion pertaining to 3825: see quickfur's first comment on https://github.com/dlang/dmd/pull/1465. -- |
November 22, 2018 [Issue 4463] [AA] double.init in associative array seems 0.0 | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=4463 Stanislav Blinov <stanislav.blinov@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stanislav.blinov@gmail.com --- Comment #4 from Stanislav Blinov <stanislav.blinov@gmail.com> --- Now that we have an .update() for AAs, this needs to be resolved. This test should pass: unittest { double[int] aa; aa[0]++; import std.math; assert(aa[0].isNaN); } The appropriate create/modify for non-zero-initialized types is: unittest { double[int] aa; aa.update(0, { return 0.0; }, (ref double d) { d++; return d; }); assert(aa[0] == 1.0); } Let's not let convenience defeat the type system, please. -- |
August 27, 2019 [Issue 4463] [AA] double.init in associative array seems 0.0 | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=4463 dlang@croco-puzzle.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dlang@croco-puzzle.com --- Comment #5 from dlang@croco-puzzle.com --- In my oppinion aa[0]++ should behave exactly the same as aa[0] = aa[0]+1. Therefore in my oppinion a correct unittest would be: unittest { import std.exception: assertThrown; import core.exception: RangeError; double[int] aa; assertThrown!RangeError(aa[0]++); } (At the moment with dmd v2.082.0 this leads to a segmentation fault, while with ldc2 1.12.0 and gdc 8.3.0 I get the expected "assertThrown failed".) -- |
December 17, 2022 [Issue 4463] [AA] double.init in associative array seems 0.0 | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=4463 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation