2022-08-03 13:58:43 |
mdavidsaver |
description |
I've been in the habit of using '%lld' and '%zu' to print 'long long' and 'size_t' respectively. However, the windows world needs '%I64d' and '%Iu' instead. It would be nice to have compatibility macros for this.
stdint.h/inttypes.h has a convention for this for the standard fixed width types. eg. PRIx32 for 'uint32_t'. This is used like:
> printf("%"PRIx32"\n", (uint32_t)42);
http://en.cppreference.com/w/c/types/integer |
I've been in the habit of using '%lld' and '%zu' to print 'long long' and 'size_t' respectively.
stdint.h/inttypes.h has a convention for this for the standard fixed width types. eg. PRIx32 for 'uint32_t'. This is used like:
> printf("%"PRIx32"\n", (uint32_t)42);
http://en.cppreference.com/w/c/types/integer
edit 2022: As Mark points out, Windows supports %zu. The remaining holdout is vxWorks... |
|