Re: array/Array: "hard" bounds checking

2018-02-22 Thread TheFlyingFiddle via Digitalmars-d-learn
On Thursday, 22 February 2018 at 12:50:43 UTC, ag0aep6g wrote: On 02/22/2018 10:39 AM, bauss wrote: On Thursday, 22 February 2018 at 05:22:19 UTC, TheFlyingFiddle wrote: Eg: uint a = 3; int b = -1; assert(a > b); //No idea what should happen here. This is what happens: assert(cast(int)a >

Re: array/Array: "hard" bounds checking

2018-02-22 Thread ag0aep6g via Digitalmars-d-learn
On 02/22/2018 10:39 AM, bauss wrote: On Thursday, 22 February 2018 at 05:22:19 UTC, TheFlyingFiddle wrote: Eg: uint a = 3; int b = -1; assert(a > b); //No idea what should happen here. This is what happens: assert(cast(int)a > b); Nope. It's `assert(a > cast(uint)b);`.

Re: array/Array: "hard" bounds checking

2018-02-22 Thread bauss via Digitalmars-d-learn
On Thursday, 22 February 2018 at 05:22:19 UTC, TheFlyingFiddle wrote: Eg: uint a = 3; int b = -1; assert(a > b); //No idea what should happen here. This is what happens: assert(cast(int)a > b);

Re: array/Array: "hard" bounds checking

2018-02-21 Thread TheFlyingFiddle via Digitalmars-d-learn
On Thursday, 22 February 2018 at 00:34:59 UTC, kdevel wrote: Is there a D equivalent of the C++ at method? I would like to reformulate repro2.d --- void main () { import std.stdio; import std.container; import std.range; auto z = Array!char(); z.reserve(0xC000_); z.capacit