D arithmetic problem

bearophile bearophileHUGS at lycos.com
Wed Jun 3 06:36:34 PDT 2009


Daniel Keep:
> *Every* integral type is signed by default.  Why should byte be an
> exception?

It's not a fault of D, it's a fault of mine, I'm just used to think of bytes as plain 8 bits, so they are unsigned.
It seems I am not the only one to have such idea of a byte. So I have suggested something to avoid some bugs, even if this makes the language a bit less uniform, breaking symmetry a bit.
D has deprecated literals as 10l to avoid bugs, even if this has broken the symmetry a bit (allowing only the upper case L).


> If it's really that much of a concern, deprecate byte and add sbyte.

I like that, this too solves the problem, and it's a solution simpler than mine.
(This doesn't solve the problem of silent conversions in D copied from C, it's not a general solution, but it's better than nothing).

Bye,
bearophile



More information about the Digitalmars-d mailing list