GTKD - Get the size of the context

Bubbasaur via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 26 11:56:55 PST 2015


On Saturday, 26 December 2015 at 13:28:31 UTC, TheDGuy wrote:
> I get the error "value of 'this' is not known at compile time" 
> which refers to the line where i create the int-array "space"
> Why is it not possible to use it there?

Just for future newcomers, the answer for the above was given 
here:
http://forum.dlang.org/post/tqvgmsluuhzzscbxhned@forum.dlang.org

By Adam D. Ruppe:

"
Try:

auto arr = new int[](size.width*size.height*3+1);

The int[x] syntax declares a statically sized array - statically 
sized meaning it must be known at compile time and thus cannot be 
variables, along a few other differences.

The new array syntax though returns one of variable size.
"

Bubba.


More information about the Digitalmars-d-learn mailing list