c style casts

Ilya Yaroshenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 15 02:31:16 PST 2016


On Friday, 15 January 2016 at 10:16:41 UTC, Warwick wrote:
> I though C style casts were not supported? But when I 
> accidentaly did
>
> int i;
> if (uint(i) < length) ....
>
> it compiled and worked fine. Whys that?

This is not a cast. You call constructor `uint(int x)`.
In the same time `uint(somethingTypeOfLong)` would not work, but 
cast(long). --Ilya


More information about the Digitalmars-d-learn mailing list