From: hpa@zytor.com (H. Peter Anvin)
To: linux-kernel@vger.kernel.org
Subject: Re: 0xdeadbeef vs 0xdeadbeefL
Date: Mon, 12 Jul 2004 17:31:21 +0000 (UTC) [thread overview]
Message-ID: <ccuht9$u85$1@terminus.zytor.com> (raw)
In-Reply-To: orn02cqs3u.fsf@livre.redhat.lsd.ic.unicamp.br
Followup to: <orn02cqs3u.fsf@livre.redhat.lsd.ic.unicamp.br>
By author: Alexandre Oliva <aoliva@redhat.com>
In newsgroup: linux.dev.kernel
>
> On Jul 6, 2004, Ray Lee <ray-lk@madrabbit.org> wrote:
>
> > Which means 0xdeadbeef is a perfectly valid literal for an unsigned int.
>
> Assuming ints are 32-bits wide. They don't have to be. They could be
> as narrow as 16 bits, in which case the constant will have type long
> or unsigned long (because long must be at least 32 bits), or they
> could be wider than 32 bits, in which case the constant will be signed
> int instead of unsigned int. You might lose either way. It's
> probably safer to make it explicitly UL, except perhaps in
> machine-specific files where the width of types is well-known.
>
If it runs Linux:
CHAR_BIT == 8
sizeof(int) == 4
sizeof(void(*)()) == sizeof(void *)
sizeof(long) == sizeof(void *)
sizeof(long long) == 8
(long)NULL == 0L
These assumptions are pretty ingrained in the Linux kernel.
-hpa
next prev parent reply other threads:[~2004-07-12 17:31 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-07 2:05 0xdeadbeef vs 0xdeadbeefL Ray Lee
2004-07-07 3:02 ` viro
2004-07-07 5:58 ` Alexandre Oliva
2004-07-07 6:12 ` Ray Lee
2004-07-07 5:55 ` Alexandre Oliva
2004-07-07 6:08 ` Ray Lee
2004-07-07 6:48 ` viro
2004-07-07 17:58 ` Alexandre Oliva
2004-07-12 17:31 ` H. Peter Anvin [this message]
2004-07-07 7:30 ` Tomas Szepe
2004-07-07 14:34 ` Jan-Benedict Glaw
2004-07-12 17:50 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2004-07-06 21:56 David Eger
2004-07-07 0:06 ` tom st denis
2004-07-07 3:00 ` viro
2004-07-07 11:10 ` tom st denis
2004-07-07 14:22 ` viro
2004-07-07 18:47 ` tom st denis
2004-07-07 16:30 ` Gabriel Paubert
2004-07-07 18:41 ` tom st denis
2004-07-07 18:47 ` Christoph Hellwig
2004-07-07 18:53 ` tom st denis
2004-07-07 23:17 ` Harald Arnesen
2004-07-08 6:15 ` David Weinehall
2004-07-08 17:16 ` Horst von Brand
2004-07-10 1:52 ` Andrew Rodland
2004-07-07 0:38 ` Richard B. Johnson
2004-07-07 4:52 ` David Eger
2004-07-07 11:40 ` Richard B. Johnson
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='ccuht9$u85$1@terminus.zytor.com' \
--to=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
/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