From 9f1f3f959d3411c200afb5a1df4fffa9d87df616 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 28 Oct 2019 21:14:23 +0100 Subject: Add macro for printf format specifier for size_t The MSVC runtime is a wierdo C89 platform with some cherry picked features from C99 (which does not include the "%zu" format specifier). This commit adds a macro with a size dependend format specifier to be used instead. Signed-off-by: David Oberhollenzer --- include/util/util.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/util/util.h') diff --git a/include/util/util.h b/include/util/util.h index 881b59c..a08c7ee 100644 --- a/include/util/util.h +++ b/include/util/util.h @@ -30,12 +30,15 @@ #if SIZEOF_SIZE_T <= SIZEOF_INT #define SZ_ADD_OV UI_ADD_OV #define SZ_MUL_OV UI_MUL_OV +#define PRI_SZ "%u" #elif SIZEOF_SIZE_T == SIZEOF_LONG #define SZ_ADD_OV UL_ADD_OV #define SZ_MUL_OV UL_MUL_OV +#define PRI_SZ "%lu" #elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG #define SZ_ADD_OV ULL_ADD_OV #define SZ_MUL_OV ULL_MUL_OV +#define PRI_SZ "%llu" #else #error Cannot determine maximum value of size_t #endif -- cgit v1.2.3