Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Mark Wielaard <mark@klomp.org>, Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
		"teawater@gmail.com" <teawater@gmail.com>
Subject: RE: [RFA record/replay] cast to avoid compiler warning
Date: Sun, 05 Oct 2008 15:47:00 -0000	[thread overview]
Message-ID: <09B97D2C4B49DF409E2D018999AC6FE115B42A89C4@PA-EXMBX14.vmware.com> (raw)
In-Reply-To: <1223208994.3267.31.camel@dijkstra.wildebeest.org>

Yes, but we don't know that gdb will always be built using gnulib.

Mark, I recognize your objection, and I'll change it with some reluctance,
but I really think you're making too big a deal out of it...

________________________________________
From: gdb-patches-owner@sourceware.org [gdb-patches-owner@sourceware.org] On Behalf Of Mark Wielaard [mark@klomp.org]
Sent: Sunday, October 05, 2008 5:16 AM
To: Mark Kettenis
Cc: Michael Snyder; gdb-patches@sourceware.org; teawater@gmail.com
Subject: Re: [RFA record/replay] cast to avoid compiler warning

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


  reply	other threads:[~2008-10-05 15:47 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
2008-10-05 15:47     ` Michael Snyder [this message]
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=09B97D2C4B49DF409E2D018999AC6FE115B42A89C4@PA-EXMBX14.vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=mark@klomp.org \
    --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