rgbds
rgbds copied to clipboard
Fix CI warnings about unknown printf format conversions
The Windows builds give a lot of "unknown conversion type character ‘z’ in format
" warnings for %zu
for size_t
, and some about ‘j’
for %j
for intmax_t
. We could define custom PRI*
-like macros for those data types, depending on the platform's size of those types.
The combinations we use: %zd %zu %jd %ju %jx
MSVC uses nonstandard %Iu
instead of %zu
for size_t
, %I
instead of %t
for ptrdiff_t
, and doesn't support %j
for intmax_t
.
Those are old non-standard extensions in MS's CRT, which even then you'd have to be linking to the ancient msvcrt C runtime to have issues here. The newer ucrt C runtime (around since 2015) support %zu and %t and %j just fine: https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-140#size-prefixes-for-printf-and-wprintf-format-type-specifiers
So it's specifically windows-xbuild
that has this issue, because it compiles with mingw32-gcc
/ mingw32-g++
. Annoying but not a significant issue.