Re: Function Error: cannot be read at compile time

2015-06-04 Thread jmh530 via Digitalmars-d-learn
On Thursday, 4 June 2015 at 17:25:52 UTC, Alex Parrill wrote: On Thursday, 4 June 2015 at 17:04:06 UTC, jmh530 wrote: float output[len]; This creates a fixed-sized array of length `len` (using the deprecated syntax). Since the length is part of the type, it needs to be known at compi

Re: Function Error: cannot be read at compile time

2015-06-04 Thread Alex Parrill via Digitalmars-d-learn
On Thursday, 4 June 2015 at 17:04:06 UTC, jmh530 wrote: float output[len]; This creates a fixed-sized array of length `len` (using the deprecated syntax). Since the length is part of the type, it needs to be known at compile time. You probably want a dynamic array instead. `auto out

Function Error: cannot be read at compile time

2015-06-04 Thread jmh530 via Digitalmars-d-learn
I'm trying to run the following code (to create an array of uniform random variables) on the latest version of rdmd (2.067.1). import std.random; auto uniform_array(int len, float a, float b) { Random gen; float output[len]; foreach(ref float i; output) {