diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-10-28 21:14:23 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-10-28 21:14:23 +0100 |
commit | 9f1f3f959d3411c200afb5a1df4fffa9d87df616 (patch) | |
tree | f9fb6a8678579bebee4dc121d63f75c3d0c224fb /include | |
parent | 587a56c4fb08ceac99752a6208d5585ba1f17957 (diff) |
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r-- | include/util/util.h | 3 |
1 files changed, 3 insertions, 0 deletions
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 |