Debug prints in @nogc

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 30 07:38:47 PDT 2016


On Tuesday, 30 August 2016 at 11:52:21 UTC, Johannes Pfau wrote:
> import std.stdio;
>
> debug
> {
>     enum writelnPtr = &writeln!string;
>     enum void function(string) @nogc writelnNoGC =
>         cast(void function(string) @nogc)writelnPtr;
> }
>
> void main() @nogc
> {
>     debug writelnNoGC("foo");
> }

Just being able to print a string is not good enough. I want the 
variadic part writeln so I can debug-print values in my buggy 
code. Do you have a similar solution?


More information about the Digitalmars-d-learn mailing list