All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@novell.com>
To: ncunningham@linuxmail.org
Cc: Linux Memory Management <linux-mm@kvack.org>
Subject: Re: Is sizeof(void *) ever != sizeof(unsigned long)?
Date: Sat, 04 Dec 2004 11:26:17 -0500	[thread overview]
Message-ID: <1102177577.6052.39.camel@localhost> (raw)
In-Reply-To: <1102155752.1018.7.camel@desktop.cunninghams>

On Sat, 2004-12-04 at 21:40 +1100, Nigel Cunningham wrote:

> I guess the subject line says it all.

In general?  Sure.  There is no guarantee in C or the "ABI Writer's
Handbook."

In Linux, though, especially the kernel, we run with that assumption.
An "unsigned long" can always hold a pointer, it is always equal to the
wordsize.  This just means that architecture ports in Linux have to be
LP32 or LP64 or whatever.

A lot of code in the kernel uses an "unsigned long" instead of a "void*"
to hold a generic memory address.  I personally like this practice, if
you never intend to directly dereference the pointer.

	Robert Love


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2004-12-04 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-04 10:40 Is sizeof(void *) ever != sizeof(unsigned long)? Nigel Cunningham
2004-12-04 16:26 ` Robert Love [this message]
2004-12-04 21:14   ` Nigel Cunningham
2004-12-04 17:02 ` Fawad Lateef
2004-12-04 21:32   ` Robert Love

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=1102177577.6052.39.camel@localhost \
    --to=rml@novell.com \
    --cc=linux-mm@kvack.org \
    --cc=ncunningham@linuxmail.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 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.