Re: c style casts

2016-01-16 Thread Warwick via Digitalmars-d-learn
On Friday, 15 January 2016 at 15:13:37 UTC, Jacob Carlborg wrote: On 2016-01-15 11:16, 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? Wouldn't a C style cast be: in

c style casts

2016-01-15 Thread Warwick via Digitalmars-d-learn
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?

Re: c style casts

2016-01-15 Thread Ilya Yaroshenko via Digitalmars-d-learn
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 `u

Re: c style casts

2016-01-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-01-15 11:16, 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? Wouldn't a C style cast be: int i; if ((uint)i < length) ? -- /Jacob Carlborg