On Friday, 6 July 2018 at 15:53:56 UTC, Ecstatic Coder wrote:

With D, ANY forgotten allocation during the game loop (and I really mean even JUST ONE hidden allocation somewhere in the whole game or engine), may cause the game to regularly freeze at the wrong time, because of an unwanted GC. Hence the phobia.

This program

import std.conv, std.stdio;

@nogc void main() {
        int point_count = 3;
        string score = point_count.to!string() ~ " POINTS";
        writeln(score);
}

provides this compiler output

nogc.d(5): Error: @nogc function 'D main' cannot call non-@nogc function 'std.conv.to!string.to!int.to'
nogc.d(5): Error: cannot use operator ~ in @nogc function 'D main'
nogc.d(6): Error: @nogc function 'D main' cannot call non-@nogc function 'std.stdio.writeln!string.writeln'

Are you saying there are bugs in the @nogc implementation? Otherwise I don't see how you will end up with a forgotten allocation.

Reply via email to