On 4/15/14, 12:18 PM, Dicebot wrote:
On Tuesday, 15 April 2014 at 19:12:30 UTC, Steven Schveighoffer wrote:
int isthisok(int x, int y) @nogc
{
// need scratch space
int[] buf = new int[x * y];
scope(exit) GC.free(buf.ptr);
// perform some algorithm using buf
...
//
return buf[$-1];
}
Valid?
No way. This can trigger GC collection. @nogc is not about observable
pre- and post- state but about prohibiting specific operation completely.
Very nice. This is a preemptive close of an entire class of arguments.
-- Andrei