diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-02-23 09:03:32 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-02-23 09:04:07 +0100 |
commit | 4fd082ded7af28929e909843eba5c801fe755257 (patch) | |
tree | 0b8afc58eee4c67c8aa4888681644fad07cbd878 /src/util.h | |
parent | 0f0a70623d089b25fb368e6aedcedccd100b3b20 (diff) | |
parent | d5f1e727a8896eec237acbbe4023685eb6b74881 (diff) | |
download | bitcoin-4fd082ded7af28929e909843eba5c801fe755257.tar.xz |
Merge pull request #3729
d5f1e72 Don't use PRIx64 formatting derives from inttypes.h (Wladimir J. van der Laan)
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/util.h b/src/util.h index 6f7627e090..6ef93021fd 100644 --- a/src/util.h +++ b/src/util.h @@ -16,7 +16,6 @@ #include <cstdio> #include <exception> -#include <inttypes.h> #include <map> #include <stdarg.h> #include <stdint.h> @@ -45,13 +44,25 @@ static const int64_t CENT = 1000000; #define UEND(a) ((unsigned char*)&((&(a))[1])) #define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) -/* Format characters for (s)size_t and ptrdiff_t (C99 standard) */ -#define PRIszx "zx" -#define PRIszu "zu" -#define PRIszd "zd" -#define PRIpdx "tx" -#define PRIpdu "tu" -#define PRIpdd "td" +/* Format characters for (s)size_t, ptrdiff_t, uint64_t. + * + * As the tinyformat-based formatting system is type-safe, no special format + * characters are really needed to specify sizes. Tinyformat can support + * (ignores) the C99 prefixes such as "ll" but chokes on MSVC's inttypes + * defines prefixes such as "I64X". So don't include inttypes.h and define our + * own for compatibility. + * If you get a warning here about a redefine of PRI?64, make sure that + * inttypes.h is not included. + */ +#define PRIszx "x" +#define PRIszu "u" +#define PRIszd "d" +#define PRIpdx "x" +#define PRIpdu "u" +#define PRIpdd "d" +#define PRIx64 "x" +#define PRIu64 "u" +#define PRId64 "d" // This is needed because the foreach macro can't get over the comma in pair<t1, t2> #define PAIRTYPE(t1, t2) std::pair<t1, t2> |