www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13066] New: pure core.stdc.stdio.sprintf

https://issues.dlang.org/show_bug.cgi?id=13066

          Issue ID: 13066
           Summary: pure core.stdc.stdio.sprintf
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

void main() pure {
    import core.stdc.stdio: sprintf;
    char[30] buf;
    sprintf(buf.ptr, "%d", 1257);
}


dmd 2.066beta1 gives:

test.d(4,12): Error: pure function 'D main' cannot call impure function
'core.stdc.stdio.sprintf'


I think sprintf should be tagged as weakly pure.

--
Jul 07 2014