Andrei Alexandrescu wrote:

Notice that the fact that one operand is a literal does not solve all of the problems I mentioned. There is for example no progress in typing u1 - u2 appropriately.

What /is/ the appropriate type here?  For example:

    uint a = uint.max;
    uint b = 0;
    uint c = uint.max - 1;

    int  x = a - b; // wrong, should be uint
    uint y = c - a; // wrong, should be int

I don't see any way to reliably produce a "safe" result at the language level.


Sean

Reply via email to