Re: [RFA record/replay] cast to avoid compiler warning

Mark Wielaard
2008-10-05T12:17:38Z

On Sat, 2008-10-04 at 23:52 +0200, Mark Kettenis wrote:
> > Date: Sat, 04 Oct 2008 11:42:47 -0700
> > From: Michael Snyder <msnyder@vmware.com>
> >
> > Sizeof returns size_t, which is not always the same as int.
> > This cast will prevent compiler warnings on some architectures
> > (eg. x86_64)
>
> This is wrong! Better cast to unsigned long and print as %lu.
>
> There is a C99 way to do this, but not all systems implement it properly.

gnulib provides a posix compatible printf that understands %z for
size_t:
http://www.gnu.org/software/gnulib/manual/html_node/printf.html

Cheers,

Mark