Eric Blake wrote:
> Should we have a gnulib module for *printf that allows us to use the
> POSIX-mandated printf("%zu", (size_t)1) modifier for size_t variables?  Or
> what is the current recommended practice for printing size_t?

libintl has a POSIX compliant printf, declared in <libintl.h>, for platforms
which don't support the %m$d syntax (NetBSD, cygwin, mingw). But it is
some overhead, of course, and can cause minor troubles. I wouldn't
recommend it for such simple things as %zu.

Therefore I recommend to simply cast the value to 'unsigned long' and
use %lu.

Bruno


Reply via email to