On Tue, 11 Jun 2013 12:39:47 +0200, Temtaime <temta...@gmail.com> wrote:

There is overflow and it can be with int too.
It's standard behavior.

Indeed. And a class is a void* is an int is a char is a double? That's
perfectly possible - it's all just memory anyway. D has chosen to do
it like this to prevent common errors. If you think the cast stands
out like a sore thumb, use:

ubyte k = 10;
ubyte c = (k + 1) & 0xFF;

That way, value range propagation ensures the result fits in a ubyte,
and the code compiles happily.

--
Simen

Reply via email to