[Bug c++/52818] New: printf format %lf is erroneously rejected by C++11

joedoefawnbuck at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sun Apr 1 11:03:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52818

             Bug #: 52818
           Summary: printf format %lf is erroneously rejected by C++11
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: joedoefawnbuck@googlemail.com


C99, and thus C++11, allow %lf as a synonym for %f as a printf format
specifier. However, with `-pedantic -Wformat -std=c++11`, GCC 4.7. emits a
warning:

#include <cstdio>
int main() { return std::printf("%lf", 0.0); }

warning: ISO C++ does not support the ‘%lf’ gnu_printf format [-Wformat]

The same holds for -std=c99 and -std=c11.



More information about the Gcc-bugs mailing list