Is this a bug?

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sat Dec 10 00:21:17 PST 2016


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.


More information about the Digitalmars-d mailing list