From: Mark Wielaard <mark@klomp.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: msnyder@vmware.com, gdb-patches@sourceware.org, teawater@gmail.com
Subject: Re: [RFA record/replay] cast to avoid compiler warning
Date: Sun, 05 Oct 2008 12:17:00 -0000 [thread overview]
Message-ID: <1223208994.3267.31.camel@dijkstra.wildebeest.org> (raw)
In-Reply-To: <200810042152.m94LqN1R018675@brahms.sibelius.xs4all.nl>
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
next prev parent reply other threads:[~2008-10-05 12:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-04 18:45 Michael Snyder
2008-10-04 21:53 ` Mark Kettenis
2008-10-05 7:12 ` Andreas Schwab
2008-10-05 9:54 ` Mark Kettenis
2008-10-05 11:02 ` Andreas Schwab
2008-10-05 12:17 ` Mark Wielaard [this message]
2008-10-05 15:47 ` Michael Snyder
2008-10-05 16:05 ` Daniel Jacobowitz
2008-10-05 18:28 ` Michael Snyder
2008-10-05 18:40 ` Mark Kettenis
2008-10-05 19:41 ` Eli Zaretskii
2008-10-05 20:35 ` Michael Snyder
2008-10-05 21:03 ` Mark Kettenis
2008-10-06 7:29 ` teawater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1223208994.3267.31.camel@dijkstra.wildebeest.org \
--to=mark@klomp.org \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
--cc=msnyder@vmware.com \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox