<inttypes.h> vs <stdint.h> mismatch
When compiling C99 for Cortex-M (and presumably for any 32-bit ARM), some types end up misaligned between <stdint.h> and <inttypes.h>.
For example, <stdint.h> typedefs int_fast32_t as "int", but <inttypes.h> defines PRIdFAST32 as "ld" instead of "d".
Which means you get format warnings from:
int_fast32_t x = 3;
printf("x=%" PRIdFAST32 "\n", x);
We did have some macro magic to try detect the problem toolchain and redefine those macros correctly, but it was too fragile, and no longer works on the current version. Any chance of a proper fix?
The basic cause seems to be that <stdint.h> is taking direction on how to define the types from built-in gcc macros __INT_FAST32_TYPE__ etc, but <inttypes.h> doesn't use those macros, and tries to guess the types by inspecting INT_FAST32_MAX, guessing "long" wrongly.
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Kevin Bracey for more information if necessary.