[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] Use inttypes macros for size_t format string
[Thread Prev] | [Thread Next]
- Subject: Re: [patch] Use inttypes macros for size_t format string
- From: g4-lisz@xxxxxxxxxxxx
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 15 Jan 2020 17:46:30 +0100
- To: libssh@xxxxxxxxxx
On 15.01.20 17:32, Andreas Schneider wrote: > On Wednesday, 15 January 2020 14:35:39 CET Jakub Jelen wrote: >> On Wed, 2020-01-15 at 13:01 +0100, g4-lisz@xxxxxxxxxxxx wrote: >>> Hi there, here's a patch for fixing a printf format string issue when >>> compiling with MinGW (and possibly other "architectures"...). >>> >>> A big thanks to Zdenek OGAR Skalak for the hint! >> Looks good to me. Grepping through the rest of the code shows that >> there will most probably be more issues like this: >> >> $ git grep "PRIdS" | wc -l >> 10 >> $ git grep "%zu" | wc -l >> 27 >> >> Could you check also the other cases to make sure we can address it in >> the whole codebase? >> >> Andreas, what do you suggest to make sure we do not introduce new >> issues like this? > %zu is ANSI C99 > > https://en.cppreference.com/w/c/io/fprintf > > That's more than 20 years old now. We had PRIdS because Visual Studio didn't > have %zu support for a long time. So we should replace PRIdS with %zu ;-) > > > Till, I'm sorry but you hit a compiler bug, open a bug against MinGW. It's not really a compiler bug. See here: https://stackoverflow.com/questions/44382862/how-to-printf-a-size-t-without-warning-in-mingw-w64-gcc-7-1 "The problem is not the compiler but the C library. MinGW uses Microsoft's "Visual C Runtime" (msvcrt) which only conforms to c89 and it doesn't support the z format specifier." If this is still true, I see no other way than using PRIdS/PRIuS to compile with MinGW ... Cheers, Till > > > Andreas >
Re: [patch] Use inttypes macros for size_t format string | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
[patch] Use inttypes macros for size_t format string | g4-lisz@xxxxxxxxxxxx |
Re: [patch] Use inttypes macros for size_t format string | Jakub Jelen <jjelen@xxxxxxxxxx> |
Re: [patch] Use inttypes macros for size_t format string | Andreas Schneider <asn@xxxxxxxxxxxxxx> |