Why does the following give me a warning (with -Wformat=2): uint32_t seconds = ... uint32_t minutes = ... uint32_t hours = ... snprintf(buf, sizeof(buf), "%" PRIu32 ":%02" PRIu32 ":%02" PRIu32, hours, minutes, seconds);
warning: long unsigned int format, uint32_t arg (arg 4) warning: long unsigned int format, uint32_t arg (arg 5) warning: long unsigned int format, uint32_t arg (arg 6) If you've got a uint32_t, then 'PRIu32' is the correct code to use, right? What OTHER code could there be for printing unsigned, 32bit, integers? cygwin's <inttypes.h> has: #define PRIu8 "u" #define PRIu16 "u" #define PRIu32 "lu" #define PRIu64 "llu" and <stdint.h> has typedef unsigned int uint32_t; This is on cygwin-1.7.0-43, with gcc-3.4.4-999. Is it possible that our inttypes.h should be changed, to use "u" for 8, 16, and 32 bits? Or is gcc's -Wformat=2 in 3.4.4 just too strict here -- and should be checking the actual bitwidths of types against the formats, before assuming that "lu" doesn't match uint32_t? -- Chuck -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/