Annoyance with new integer promotion deprecations

Luís Marques luis at luismarques.eu
Wed Feb 7 15:29:52 UTC 2018


On Wednesday, 7 February 2018 at 11:30:02 UTC, Dominikus Dittes 
Scherkl wrote:
> Very cool! Much better than implementing new types.
> Just
>
>>     auto opBinary(string op, U)(NX!U rhs)
>>     {
>>         static if(rhs.value.sizeof > value.sizeof)
>>             return mixin("rhs " ~ op ~  " value");
>
> That won't do anything good for operators that are NOT 
> commutative
> (like -, ^^, <<, >>, %, /, ...)
> Seems you don't use other things than +, *, &, | and ^, do you?

Ahah! That "fix" was only a temporary workaround for a unittest. 
In my actual code the rhs is always a T, not a NX!U, so it didn't 
matter. I forgot to remove that kludge before I copy pasted it 
here :-)


More information about the Digitalmars-d mailing list