Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 22, 2017 [Issue 17418] opCmp return value unclear | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17418 Mathias Baumann <mathias.baumann@sociomantic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |spec -- |
May 22, 2017 [Issue 17418] opCmp return value unclear | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17418 Jonathan M Davis <issues.dlang@jmdavisProg.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |issues.dlang@jmdavisProg.co | |m --- Comment #1 from Jonathan M Davis <issues.dlang@jmdavisProg.com> --- I would point out that the return values don't need to be spcecific numbers. They only need to be < 0, == 0, or > 0. And requiring them to be -1, 0, and +1 would be less efficient in a number of cases. Now, looking over that page, I agree that it's not as clear as it should be, and the problem seems to be that it's focused on how the compiler is going to take the return value and use that to generate the correct code for the comparison rather than what the programmer needs to do with opCmp to make it work correctly. But from the perspective of the person writing opCmp, opCmp should return a value < 0 if lhs < rhs, 0 if lhs == rhs, and a value > 0 if lhs > rhs. -- |
December 20, 2019 [Issue 17418] opCmp return value unclear | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17418 berni44 <bugzilla@d-ecke.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@d-ecke.de --- Comment #2 from berni44 <bugzilla@d-ecke.de> --- Meanwhile the definition [1] defines three cases returning an int (<, ==, >), but as far as I know, it's also possible to have reals as return types and in this cases NaN is a fourth possible result. [1] https://dlang.org/phobos/object.html#.Object.opCmp -- |
July 15, 2022 [Issue 17418] opCmp return value unclear | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17418 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |FIXED --- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> --- This has been added to spec. -- |
Copyright © 1999-2021 by the D Language Foundation