Common type of ubyte and const ubyte is int
Dom DiSc
dominikus at scherkl.de
Sun May 5 11:48:08 UTC 2024
On Sunday, 5 May 2024 at 04:13:16 UTC, Jonathan M Davis wrote:
> And on top of that, by changing D to not do integer promotion
> with the ternary operator, we would be more compatible with C++
> where the difference _does_ matter, because they have their own
> auto, and they have function overloading.
>
integer promotion wouldn't hurt us, if it would promote to
something sensible. promoting (ubyte, uint) to int is not
sensible. it introduces a sign where there was none before and
thereby destroy large uint values. I see no benefit in staying
compatible to such strange behaviour of C.
The common type of (T, const T) should be const T for any T and
not something arbitrary. (And int is arbitrary, because why not
short or long? - and don't call C compatibility here, because C
*does* use short on 16bit machines and long for some 64bit
machines!)
More information about the Digitalmars-d
mailing list