1

For a sequence of

typedef  int64_t     I64;
I64 i=5;
printf("%"PRIi64",i);

cppcheck gives the warning below:

warning: %lld in format string (no. 1) requires 'long long' but the argument type is 'signed int'.

The makro PRIi64 is resolved by lld, this is correct, but the 64 bit integer type is not accepted as long long int.

I hope there is a way to resolve this, because we get a lot of such warnings in our project and don't see the real bugs anymore.

  • 1
    What does you mean with "extraneous quote"? "PRIi64" is taken from "inttypes.h" (C99) and normally required to write 32/64 bit indepentand code, because you need %lld on 32 bit and %ld on 64 bit engines for a int64_t (stdint.h). – Falk Reichbott Mar 23 '16 at 07:34
  • 1
    Yes correct, but this has nothing to do with my real question. Here more correct: printf("somthing %"PRIi64" else",i); – Falk Reichbott Mar 23 '16 at 11:55

1 Answers1

0

The latest version of Cppcheck does not shown a warning about following example code:

void f(void)
{
    typedef int64_t I64;
    I64 i=5;
    printf("%"PRIi64",i);
}
orbitcowboy
  • 1,438
  • 13
  • 25