symmetric signed types

Timon Gehr timon.gehr at gmx.ch
Sat Jan 25 05:43:24 PST 2014


On 01/25/2014 01:57 PM, Dominikus Dittes Scherkl wrote:
> ...
> Walter wrote:
> "There's no NaN for integrals."
>
> At least the carry-bit is already available in hardware. So the save
> type doesn't incure much performance loss in operations. On the other
> hand comparison, assignment and casts become slower by a factor 2 or 3.
> And then comparison cannot be implemented fully correct with the current
> operator overloding system of D.

Why not?

struct S{
     auto opCmp(S r){ return float.nan; }
}

void main(){
     S s;
     assert(s!<>=s);
}



More information about the Digitalmars-d mailing list