Why there is too many uneccessary casts?

Adam D. Ruppe destructionator at gmail.com
Tue Jun 11 09:18:52 PDT 2013


On Tuesday, 11 June 2013 at 16:05:30 UTC, Steven Schveighoffer 
wrote:
> CPU performs math at int level.

eh, I wouldn't blame the hardware. You can do

asm {
   mov AL, 10;
   add AL, 5;
}

and it is allowed, it also don't spill into AH if you overflow it 
(it just sets the carry flag). I'm sure it is different on 
different processors, but x86 is pretty flexible.


> ubyte c = k;
> c += 1; // ok
>
> This I find extremely inconsistent...

I'd be extremely annoyed if that required a cast. It's bleeding 
obvious that you want it to assign back there....


More information about the Digitalmars-d-learn mailing list