I am working with the tricore v3.4.6 compiler.
Suppose I have a signed integer like sint32 a = -1
and want to print that with printf
.
I tried printf("Signed number %i", a)
as well as printf("Signed number %d", a)
which both gives me compiler warnings, for example
warning: int format, sint32 arg
unlike suggested in the comments to the question, sint32
is not uncommon in safety critical and embedded systems and usually falls back to a typecast for int
. (e.g. in some MISRA environments).
Hence
sint32 a = -1;
printf("%d", a);
should do the trick anyways. tested with gcc v5.2.1 and arm-gcc v5.2.1 (-Wall and no warnings).
If it still gives you a warning try to figure out what sint32
really maps to and try long
-print: printf("%ld")
. However, then double check if the byte length of sint32
really is 32bits? (and some systems may even have less than a 32bit architecture)