On 12/11/12 8:24 AM, d coder wrote:

    No, it's a fix of a gotcha from C. The C code would just allow the
    assignment.


Yes Andrei.

But it does not look clean if you have to write:

byte a, b, c;
a = cast(byte) (b + c);

Well I know the advantages (safety). But imagine having to write all
that when working with bytes and shorts. Makes it really difficult to
work with shorts and bytes in D.

Value range propagation automatically avoids the need for a lot of those casts. http://www.drdobbs.com/tools/value-range-propagation/229300211

Would I be asking for too much if I ask
DMD to provide a compiler flag that makes it return bytes and shorts for
operations on them?

That won't happen.


Andrei

Reply via email to