From: Arnd Hannemann <arnd@arndnet.de>
To: Christian Parpart <trapni@gmail.com>
Cc: linux-btrfs@vger.kernel.org, chris.mason@oracle.com
Subject: Re: [PATCH] Btrfs-progs: satisfy compiler and change printf modifier
Date: Mon, 14 Nov 2011 16:51:44 +0100 [thread overview]
Message-ID: <4EC13910.7050102@arndnet.de> (raw)
In-Reply-To: <CA+qvzFPH8qsdGap4U1rLexMhNzaC8f+HoaqZoGB424OqmS6nTQ@mail.gmail.com>
Am 14.11.2011 16:30, schrieb Christian Parpart:
> On Mon, Nov 14, 2011 at 4:24 PM, Arnd Hannemann <arnd@arndnet.de <mailto:arnd@arndnet.de>> wrote:
>
> One-liner which fixes the gcc warning:
> warning: format '%u' expects argument of type 'unsigned int',
> but argument 3 has type 'long unsigned int' [-Wformat]
>
>
> [snip]
>
> - printf("Size is %u, needs to be %u, slot %d\n", item_size,
> + printf("Size is %u, needs to be %zu, slot %d\n", item_size,
> sizeof(*ei), path->slots[0]);
>
>
> shouldn't it be %lu then (instead of %zu) ?
No, the return type of sizeof() is size_t which is of different size on different
architectures (eg. amd64 versus i386)
If %lu would be used, there would be a warning when compiled on an architecture where
long is 32 bit.
Best regards,
Arnd
prev parent reply other threads:[~2011-11-14 15:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 15:24 [PATCH] Btrfs-progs: satisfy compiler and change printf modifier Arnd Hannemann
[not found] ` <CA+qvzFPH8qsdGap4U1rLexMhNzaC8f+HoaqZoGB424OqmS6nTQ@mail.gmail.com>
2011-11-14 15:51 ` Arnd Hannemann [this message]
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=4EC13910.7050102@arndnet.de \
--to=arnd@arndnet.de \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=trapni@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.