Re: 0xdeadbeef vs 0xdeadbeefL

From: H. Peter Anvin (hpa_at_zytor.com)
Date: 07/12/04

  • Next message: H. Peter Anvin: "Re: [discuss] Re: Opteron bug"
    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/


  • Next message: H. Peter Anvin: "Re: [discuss] Re: Opteron bug"

    Relevant Pages

    • (no subject)
      ... Jul 13 17:50:50 linux kernel: printing eip: ... static int pos_open(struct inode *inode, ... static int pos_release(struct inode *inode, ...
      (Linux-Kernel)
    • Re: Help! Shared memory is getting deleted after process is killed
      ... breaking due to a local patch applied to the linux kernel in our ... Also, I am getting the errno as ENOENT, which means ... int do_shm ... shmId = shmget; ...
      (comp.os.linux.development.apps)
    • Newbie questions on the kernel programming
      ... I am learning linux kernel programming starting from "The Linux Kernel ... static short int myshort = 1; ... How does the /proc file system ...
      (Linux-Kernel)
    • Newbie questions on the kernel programming
      ... I am learning linux kernel programming starting from "The Linux Kernel ... static short int myshort = 1; ... How does the /proc file system ...
      (comp.os.linux.development.system)
    • Re: 0xdeadbeef vs 0xdeadbeefL
      ... Assuming ints are 32-bits wide. ... int instead of unsigned int. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)