OT (partially): about promotion of integers

eles eles at eles.com
Tue Dec 11 07:27:02 PST 2012


>  Now, the off-topic question: the loss in unsigned-range aside 
> (that I find it to be a small price for the earned clarity), is 
> that any other reason (except C-compatibility) that D would not 
> implement that model (this is not a suggestion to do it now, I 
> know D is almost ready for prime-time, but it is a question), 
> that is the int-FPC like model for integral types?
>

Rephrasing all that, it would be just like the fundamental type 
in D would be the widest-integral type, and the unsigned variant 
of that widest-integral type would be supprimated.

Then, all operands in an integral operations would be first 
promoted to this widest-integral, computation would be made, then 
the final result may be demoted back (the compiler is free to 
optimize it as it wants, but behind the scene).



More information about the Digitalmars-d mailing list