Feedback Wanted on Homegrown @nogc WriteLn Alternative

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 26 18:35:11 PDT 2014


On Fri, Sep 26, 2014 at 11:55:58PM +0000, Kitt via Digitalmars-d wrote:
> Large sections of my codebase require full control over when and how
> the GC is run. The new @nogc (as well as -vgc switch) has been
> amazingly helpful in developing safe code I can trust wont cause the
> GC to run; however, there are a few aspects of D I simply have to
> learn to work without in these cases. One good example is WriteLn and
> it's cousins. To this end, I'm writing my own @nogc version of WriteLn
> that uses the C printf and sprintf underneath.

Did the forum web interface cut off your post? I only see the definition
of Info and nothing else.

Anyway, what I have in mind is more to take the current Phobos
std.format (of which writeln is just a thin wrapper), stick @nogc on it,
and hack it until it either compiles with @nogc, or isolate the GC parts
such that most calls to std.format (via writeln) are @nogc except when
you actually pass it something that must allocate.


T

-- 
People walk. Computers run.


More information about the Digitalmars-d mailing list