Re: anyway to debug nogc code with writeln?

2018-09-03 Thread aliak via Digitalmars-d-learn
On Saturday, 1 September 2018 at 22:38:46 UTC, Ali Çehreli wrote: You can strip off any attribute with SetFunctionAttributes: import std.stdio; // Adapted from std.traits.SetFunctionAttributes documentation import std.traits; auto assumeNoGC(T)(T t) if (isFunctionPointer!T || isDelegate!T)

Re: anyway to debug nogc code with writeln?

2018-09-02 Thread Dennis via Digitalmars-d-learn
On Saturday, 1 September 2018 at 21:53:03 UTC, aliak wrote: Anyway around this? I don't know if your situation allows it, but you can mark f explicitly as always @nogc. If your design assumes that it's @nogc, it's a good idea to add the attribute anyway. You can also use the C printf functi

Re: anyway to debug nogc code with writeln?

2018-09-01 Thread Ali Çehreli via Digitalmars-d-learn
You can strip off any attribute with SetFunctionAttributes: import std.stdio; // Adapted from std.traits.SetFunctionAttributes documentation import std.traits; auto assumeNoGC(T)(T t) if (isFunctionPointer!T || isDelegate!T) { enum attrs = functionAttributes!T | FunctionAttribute.nogc;

anyway to debug nogc code with writeln?

2018-09-01 Thread aliak via Digitalmars-d-learn
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 th