[Issue 20669] New: Deprecation when passing string length as printf argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 11 22:57:04 UTC 2020


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

          Issue ID: 20669
           Summary: Deprecation when passing string length as printf
                    argument
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: moonlightsentinel at disroot.org

The lenght of a string can be passed as an additional argument preceding the
pointer. But DMD issues a warning about missmatched argument types.

-------------------------------------

void main()
{
    import core.stdc.stdio : printf;
    string s = "Hello, World";
    printf("%.s", s.length, &s[0]);
}

-------------------------------------

print.d(5): Deprecation: argument s.length for format specification "%.s" must
be char*, not uint

--


More information about the Digitalmars-d-bugs mailing list