www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17418] New: opCmp return value unclear

https://issues.dlang.org/show_bug.cgi?id=17418

          Issue ID: 17418
           Summary: opCmp return value unclear
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: mathias.baumann sociomantic.com

When implementing an opCmp, I pretty much always need to look up how it is
defined and the specification constantly disappoints but not saying a word of
what the function should actually return for which case.

you can kind of extract that info from the re-write rules, but why make it so
difficult and not just say something like

RETURN   A   B
   -1    2   1
    0    2   2
   +1    1   2

(or whatever the correct numbers are)

Link to unclear definition:

http://dlang.org/spec/operatoroverloading.html#compare

--
May 22