On 10.12.2016 09:24, Is it possible to store different generic types? wrote:
On Saturday, 10 December 2016 at 08:21:17 UTC, Stefan Koch wrote:
On Saturday, 10 December 2016 at 08:16:48 UTC, Is it possible to store
different generic types? wrote:
On Saturday, 10 December 2016 at 08:09:00 UTC, Is it possible to
store different generic types? wrote:
[...]
Okay the issue seem to be that D casts the left-hand argument to the
same type as the right-hand argument.
So when ex. doing "targetX < x + width" then it actually does
"targetX < cast(width_type)x + width"
Where as I'd believe the behavior should have been "targetX < x +
cast(x_type)width"
Simply don't mix signed and unsigned types.
That is begging for trouble.
or convert them to the next highter signed type.
Yeah, that's what I'm doing now. It seems like concepts of casting from
other languages just can't be applied to D,
From /some/ other languages, which is unavoidable, because different
languages behave differently.
which is a bothersome.