public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: PATCH: type safe(r) list_entry repacement: generic_out_cast
Date: Wed, 24 Jul 2002 01:04:53 +0000 (UTC)	[thread overview]
Message-ID: <ahkufl$25v$1@penguin.transmeta.com> (raw)
In-Reply-To: 200207240051.CAA16434@harpo.it.uu.se

In article <200207240051.CAA16434@harpo.it.uu.se>,
Mikael Pettersson  <mikpe@csd.uu.se> wrote:
>On Tue, 23 Jul 2002 18:58:52 -0400, Kevin O'Connor wrote:
>>#define BackPtr(ptr, type, member) ({                                         \
>>        typeof( ((type *)0)->member ) *__mptr = (ptr);                        \
>>        ((type *)( (char *)__mptr - (unsigned long)(&((type *)0)->member) ));})
>
>I've seen this sort of code several times now in the Linux kernel,
>and I've never liked it. Is there some reason why you guys avoid
>offsetof() like the plague?

Trivial answer: offsetof() does not exist when you don't have system
header files. 

So it's not that it's getting avoided, it _has_ to be re-implemented
anyway.  And once you do that, you might as well do it right (ie what
the kernel wants is not offsetof, but a new pointer.

		Linus

  reply	other threads:[~2002-07-24  1:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24  0:51 PATCH: type safe(r) list_entry repacement: generic_out_cast Mikael Pettersson
2002-07-24  1:04 ` Linus Torvalds [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-23 11:28 Neil Brown
2002-07-23 11:47 ` Jakob Oestergaard
2002-07-23 12:42 ` Brian Gerst
2002-07-23 16:29 ` Linus Torvalds
2002-07-24  5:25   ` Thunder from the hill
2002-07-23 16:36 ` Christoph Hellwig
2002-07-23 22:58 ` Kevin O'Connor

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='ahkufl$25v$1@penguin.transmeta.com' \
    --to=torvalds@transmeta.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