symmetric signed types
bearophile
bearophileHUGS at lycos.com
Thu Jan 23 06:40:57 PST 2014
Dominikus Dittes Scherkl:
> E.g. "ubyte abs(byte)" - this functions which can't even use a
> template, or has anybody a good idea ho to express
> "unsigned T abs(T)(T x)"?
I think this is not hard to do in D.
> by the way: why wasn't "short" instead called "word"?
On most modern CPUs a word is longer than a short.
> It worked all well until I found that the new operators !<> !<=
> etc can't be overloaded (they are only available for floating
> types)! Why is this so?
> D made all the floating point stuff so much better than C, but
> the integral types still suffer the same old flaws.
Those FP operators are about to be deprecated. Apparently they
add too much complexity for what they offer. using std.math.isNan
should suffice.
Bye,
bearophile
More information about the Digitalmars-d
mailing list