Feedback Wanted on Homegrown @nogc WriteLn Alternative

Joseph Rushton Wakeling via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 3 02:24:28 PDT 2014


On Friday, 3 October 2014 at 08:34:27 UTC, Ola Fosheim Grøstad 
wrote:
> Maybe you could do this as some kind of implicit range of 
> "formatting references" so that you can iterate over it in two 
> passes and save a heap allocation for situations where 
> traversal is cheap (fits in level 1 cache):
>
> 1. first pass: collect max buffer size
> 2. alloca buffer on stack
> 3. second pass: format into buffer
>
> ?

Won't that potentially fail based on the question of what the 
input is?  What if you're calling

     newWritefln("A random number: %g", rndGen);

or,

     newWriteln("An input range: ", 
someNonDeterministicInputRange);


More information about the Digitalmars-d mailing list