Types A!1 and A!1u not considered equal?

Jonathan M Davis jmdavisProg at gmx.com
Fri Oct 21 01:01:59 PDT 2011


On Friday, October 21, 2011 11:57:50 Gor Gyolchanyan wrote:
> That's because implicit casts in D are much more strict, then those in
> C/C++. Such seemingly intuitive cats, e.g. from long to int are not
> performed due to potential loss of data.
> Casting from int to uint has the same effect of potential loss of data.

In D, integral types implicitly convert to their unsigned counterparts and 
vice versa. D does not consider those conversions to be narrowing conversions 
which require a cast (though they _are_ narrowing conversions and do risk 
messing up the number if it's too large or too small).

- Jonathan M Davis


More information about the Digitalmars-d mailing list