AnsweredAssumed Answered

64-bit type support

Question asked by David Smith on Jan 27, 2016
Latest reply on Aug 1, 2016 by xiangjun.rong

I'm working on the K64F freedom board trying to port some code and running into an issue when trying to work with 64-bit types. The following snippet


snprintf(text, idx, "%"PRId64"", val);


produces the following warning


warning: format '%d' expects argument of type 'int', but argument 4 has type 'int64_t' [-Wformat=]


at compile time. Digging into inttypes.h which defines PRId64 I found that it's dependant on the define __have_longlong64 to correctly set PRId64 to the expected value of lld as expected by snprintf. When I look at



I see that there are a few different versions of the stdint.h header, specifically I see the following

  1. toolchain/arm-none-eabi/include/stdint.h
  2. toolchain/lib/gcc/arm-none-eabi/4.8.4/include/stdint.h
  3. toolchain/lib/gcc/arm-none-eabi/4.8.4/include/sdtint-gcc.h


File #2 essentially wraps #3. They don't define __have_longlong64, even though the code completion shows that an int64_t expands to long long int. It also seems that trying to print an int64_t by manually specifying %lld doesn't work and just results ld being printed.