www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21986] New: pragma(printf) warns about valid but non-portable

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

          Issue ID: 21986
           Summary: pragma(printf) warns about valid but non-portable
                    specifiers
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.096.1, compiling the following program results in a deprecation
message:

---
import core.stdc.stdio;

void main()
{
    printf("%'d", 123456789);
    // Deprecation: format specifier `"%'"` is invalid
}
---

The cause is the `'` (apostrophe) used as a flag in the format specifier, which
is not one of the flag characters specified in the C99 standard. However, it is
supported on some POSIX platforms, including Linux with glibc.

It would be preferable if deprecation messages for non-portable format
specifiers were suppressed when compiling for a platform that is known to
support them.

--
May 28 2021