public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakob Oestergaard <jakob@unthought.net>
To: Neil Brown <neilb@cse.unsw.edu.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PATCH: type safe(r) list_entry repacement: generic_out_cast
Date: Tue, 23 Jul 2002 13:47:03 +0200	[thread overview]
Message-ID: <20020723114703.GM11081@unthought.net> (raw)
In-Reply-To: <15677.15834.295020.89244@notabene.cse.unsw.edu.au>

On Tue, Jul 23, 2002 at 09:28:26PM +1000, Neil Brown wrote:
> 
...
> Why "out_cast"???
> 
> Well OO people would probably call it a "down cast" as you are
> effectively casting from a more-general type to a less-general (more
> specific) type that is there-fore lower on the type latice.
> So maybe it should be "generic_down_cast".
> But seeing that one is casting from an embeded internal structure to a
> containing external structure, "out_cast" seemed a little easier to
> intuitively understand.

This is one of the type issues that C++ would solve nicely - not because
of OO, but because of parameterized types.  Completely removing the need
to do any kind of casting (in this situation), and allowing the compiler
to inline based on the actual use of types in each specific
instantiation of a function such as a list utility funciton.  Type safe
code that runs faster, yay!.

Yes, I know, it doesn't help us one bit here, because they'll be selling
snow-cones in hell before the kernel is rewritten in C++.  And there are
many good reasons why it is like that.

I'm happy to see someone taking an initiative to improve type safety (as
much as the language allows).  And the above was just pointed out
because of the occational "why not C++" versus "no OO sucks" (as if C++
was just OO) debates.

Cheers,

-- 
................................................................
:   jakob@unthought.net   : And I see the elder races,         :
:.........................: putrid forms of man                :
:   Jakob Østergaard      : See him rise and claim the earth,  :
:        OZ9ABN           : his downfall is at hand.           :
:.........................:............{Konkhra}...............:

  reply	other threads:[~2002-07-23 11:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-23 11:28 PATCH: type safe(r) list_entry repacement: generic_out_cast Neil Brown
2002-07-23 11:47 ` Jakob Oestergaard [this message]
2002-07-23 22:07   ` type safe lists (was Re: PATCH: type safe(r) list_entry repacement: generic_out_cast) Joshua MacDonald
2002-07-24  7:39     ` Martin Brulisauer
2002-07-24  8:24       ` Anton Altaparmakov
2002-07-24  9:56       ` Joshua MacDonald
2002-07-24 10:50         ` Martin Brulisauer
2002-07-24 11:58           ` Jakob Oestergaard
2002-07-24 16:49             ` John Alvord
2002-07-25  5:29       ` Greg KH
2002-07-25  6:20         ` Roland Dreier
2002-09-04 13:48         ` Alexander Kellett
2002-09-04 14:27           ` DervishD
2002-07-24 12:22     ` Jakob Oestergaard
2002-07-24 12:40       ` Joshua MacDonald
2002-07-24 15:15         ` Hans Reiser
2002-07-23 12:42 ` PATCH: type safe(r) list_entry repacement: generic_out_cast 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
2002-07-24 12:38 ` PATCH - mark 2: type safe(r) list_entry repacement: container_of Neil Brown
  -- strict thread matches above, loose matches on Subject: below --
2002-07-24  0:51 PATCH: type safe(r) list_entry repacement: generic_out_cast Mikael Pettersson
2002-07-24  1:04 ` Linus Torvalds

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=20020723114703.GM11081@unthought.net \
    --to=jakob@unthought.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    /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