[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] printing size_t variables
From: |
Bruno Haible |
Subject: |
Re: [bug-gnulib] printing size_t variables |
Date: |
Sat, 2 Sep 2006 19:07:57 +0200 |
User-agent: |
KMail/1.9.1 |
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