Re: 0xdeadbeef vs 0xdeadbeefL
From: H. Peter Anvin (hpa_at_zytor.com)
Date: 07/12/04
- Previous message: Tim Bird: "Re: [PATCH] preset loops_per_jiffy for faster booting"
- In reply to: Alexandre Oliva: "Re: 0xdeadbeef vs 0xdeadbeefL"
- Next in thread: Tomas Szepe: "Re: 0xdeadbeef vs 0xdeadbeefL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: linux-kernel@vger.kernel.org Date: Mon, 12 Jul 2004 17:31:21 +0000 (UTC)
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Tim Bird: "Re: [PATCH] preset loops_per_jiffy for faster booting"
- In reply to: Alexandre Oliva: "Re: 0xdeadbeef vs 0xdeadbeefL"
- Next in thread: Tomas Szepe: "Re: 0xdeadbeef vs 0xdeadbeefL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|