Debian Codegraph @

lib/util/prisize_t.h

raw
1 /// @file
2 /// @ingroup cgraph_utils
3 #pragma once
4
5 /// `PRIu64` alike for printing `size_t`
6 ///
7 /// Use this as:
8 ///
9 /// \code{.c}
10 /// size_t value = 42;
11 /// printf("value is %" PRISIZE_T ".", value);
12 /// // prints “value is 42.”
13 /// \endcode
14 ///
15 /// Note that leaving a space on either side of `PRISIZE_T` does not seem
16 /// relevant in C, but if you omit this in C++ it will be interpreted as a
17 /// user-defined string literal indicator. So it is best to always use a space
18 /// on either side.
19 #ifdef __MINGW64__
20 // Microsoft’s Visual C Runtime (msvcrt) ships a printf that does not
21 // understand "%zu". MSVC itself uses a different printf that does not rely on
22 // this, but MinGW uses msvcrt and so cannot handle "%zu".
23 #define PRISIZE_T "llu"
24 #else
25 #define PRISIZE_T "zu"
26 #endif