From: Laszlo Ersek <lersek@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Jeff Cody <jcody@redhat.com>, Alexander Graf <agraf@suse.de>,
"Richard W.M. Jones" <rjones@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants
Date: Fri, 14 Mar 2014 19:57:30 +0100 [thread overview]
Message-ID: <5323511A.6040501@redhat.com> (raw)
In-Reply-To: <53234F39.6060901@redhat.com>
On 03/14/14 19:49, Laszlo Ersek wrote:
> One good example is for 6.4.4.1 "Integer constants":
>
> QUIET CHANGE IN C99
>
> Unsuffixed integer constants may have different types in C99 than
> in C89. Such constants greater than LONG_MAX are of type unsigned
> long in C89, but are of type long long in C99 (if long long has
> more range than long).
>
> I have no clue what gnu89 does.
x.c:
#include <stdio.h>
int
main(void)
{
fprintf(stdout, "%u\n", (unsigned)sizeof 2147483648);
return 0;
}
The following script:
for I in c89 gnu89 c99 gnu99; do
echo "==== $I ===="
gcc -m32 -o x -std=$I x.c
./x
done
outputs:
==== c89 ====
x.c: In function 'main':
x.c:6:3: warning: this decimal constant is unsigned only in ISO C90
[enabled by default]
fprintf(stdout, "%u\n", (unsigned)sizeof 2147483648);
^
4
==== gnu89 ====
x.c: In function 'main':
x.c:6:3: warning: this decimal constant is unsigned only in ISO C90
[enabled by default]
fprintf(stdout, "%u\n", (unsigned)sizeof 2147483648);
^
4
==== c99 ====
8
==== gnu99 ====
8
Laszlo
prev parent reply other threads:[~2014-03-14 18:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 10:50 [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants Jeff Cody
2014-03-14 15:25 ` Stefan Hajnoczi
2014-03-14 15:36 ` Richard W.M. Jones
2014-03-14 15:38 ` Peter Maydell
2014-03-14 15:57 ` Richard W.M. Jones
2014-03-14 16:26 ` Laszlo Ersek
2014-03-14 16:51 ` Richard W.M. Jones
2014-03-14 17:27 ` Laszlo Ersek
2014-03-14 17:49 ` Richard W.M. Jones
2014-03-14 18:16 ` Laszlo Ersek
2014-03-14 16:17 ` Laszlo Ersek
2014-03-14 16:26 ` Peter Maydell
2014-03-14 16:35 ` Laszlo Ersek
2014-03-14 16:36 ` Laszlo Ersek
2014-03-14 17:08 ` Peter Maydell
2014-03-14 17:42 ` Laszlo Ersek
2014-03-14 18:22 ` Peter Maydell
2014-03-14 18:49 ` Laszlo Ersek
2014-03-14 18:57 ` Laszlo Ersek [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=5323511A.6040501@redhat.com \
--to=lersek@redhat.com \
--cc=agraf@suse.de \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).