anyway to debug nogc code with writeln?

aliak something at something.com
Sat Sep 1 21:53:03 UTC 2018


I would like to debug a few things and need to insert print 
statements to figure things out. I thought that using debug print 
would be ok in nogc code?

Seems it make the compiler infer f as not nogc though so this is 
basically unworkable unless I go through my entire source code 
and remove the @nogc attribute wherever function f is used.

Anyway around this?

Here's example code:

import std.stdio;

void f(T)(auto ref T) {
     debug writeln("yo");
}

@nogc void main() {
	f(3);
}

Error: @nogc function D main cannot call non- at nogc function 
onlineapp.f!int.f

Cheers,
- Ali


More information about the Digitalmars-d-learn mailing list