digitalmars.D.learn - c style casts
- Warwick (5/5) Jan 15 2016 I though C style casts were not supported? But when I accidentaly
- Ilya Yaroshenko (4/9) Jan 15 2016 This is not a cast. You call constructor `uint(int x)`.
- Jacob Carlborg (7/11) Jan 15 2016 Wouldn't a C style cast be:
- Warwick (2/13) Jan 16 2016 Yeah bad memory on my part, it's C++ cast, or one of them.
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?
Jan 15 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
Jan 15 2016
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
Jan 15 2016
On Friday, 15 January 2016 at 15:13:37 UTC, Jacob Carlborg wrote:On 2016-01-15 11:16, Warwick wrote:Yeah bad memory on my part, it's C++ cast, or one of them.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)
Jan 16 2016