OT (partially): about promotion of integers
eles
eles at eles.com
Tue Dec 11 10:36:37 PST 2012
> Why stop at 64 bits? Why not make there only be one integral
> type, and it is of whatever precision is necessary to hold the
> value? This is quite doable, and has been done.
You really miss the point here. Nobody will ask you to promote
those numbers to 64-bit or whatever *unless necessary*. It will
only modify the implicit promotion rule, from "at least to int"
to "widest-integral".
You may chose, as a compiler, to promote the numbers only to 16
bits, or 32 bits, if you like, but only if the final result is
not viciated.
The compiler will be free to promote as it likes, as long as it
guarantees that the final result is "as if" the promotion is to
the widest-integral.
The point case is that this way the promotion rules, quite
complex now, will go straightforward. Yes, the burden will be on
the compiler rather than on the user. But this could improve in
time: C++ classes are nothing else than a burden that falls on
the compiler in order to make the programmer's life easier. Those
classes too, started as big behemots, so slow that scared
everyone.
Anyway, I will not defend this to the end of the world. Actually,
if you look in my original post, you will see that this is a
simple question, not a suggestion.
Until now the question received many backfights, but no answer.
A bit shameful.
More information about the Digitalmars-d
mailing list