www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20566] New: std.sformat should avoid allocating memory when


          Issue ID: 20566
           Summary: std.sformat should avoid allocating memory when
                    printing floating point values
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: r.sagitario gmx.de


import std.format;
import core.memory;
import std.stdio;
import std.format;

void main()
    char[4096] buf;
    foreach (i; 0 .. 10) {
        sformat(buf[], "%a", 1.234f);

shows that an invocation of sformat allocates, even though a large buffer is
passed in. This didn't happen in 2.089, but in 2.090 and all other versions
before 2.089.

Feb 07 2020