On Thursday, 17 April 2014 at 15:02:27 UTC, Dicebot wrote:
void foo(OutputRange buffer) { buffer.put(42); }`foo` can't be @nogc here if OutputRange uses GC as backing allocator. However I'd really like to use it to verify that no
Can't you write foo as a template? Then if "buffer" is a ring buffer the memory might be allocated by GC, which is ok if put() does not call the GC and is marked as such.
Where this falls apart is when you introduce a compacting GC and the @nogc code is run in a real time priority thread. Then you need both @nogc_function_calls and @nogc_memory .
Of course, resorting to templates requires some thinking-ahead, and makes reuse more difficult.
You'll probably end up with the @nogc crowd creating their own NoGCOutputRange⦠:-P
Ola.
