From: Rusty Russell <rusty@rustcorp.com.au>
To: Andi Kleen <andi@firstfloor.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Bert Wesarg <bert.wesarg@googlemail.com>,
Tejun Heo <htejun@gmail.com>
Subject: Re: [PULL] typesafe callbacks for kthread and stop_machine
Date: Fri, 1 Aug 2008 10:39:29 +1000 [thread overview]
Message-ID: <200808011039.30195.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20080731140643.GO23938@one.firstfloor.org>
On Friday 01 August 2008 00:06:43 Andi Kleen wrote:
> On Thu, Jul 31, 2008 at 02:52:35PM +1000, Rusty Russell wrote:
> > Just the two places I look after. And this time the conglomerate patch
> > is included below for more random commentry.
>
> I must say I personally don't like the wrapper macros that you require
> for each function that uses this. A wrapper macro has a large impact
> on code readability because everyone following a call chain has
> to do an additional grep/open file etc. step. I have my doubts not having
> casts outweights that disadvantage.
Yes, but the benefits of using them everywhere is that they do become part of
the landscape. "Oh, that's a typesafe callback, OK".
If this were just about neatness, I'd share your doubts. But I want to be
able to change the type of a var and have the compiler complain when I hand
it to a function which expects the old type. This bit me a few months back,
leading to this experiment.
> I know that gcc has this funky transparent union extension that
> glibc socket() uses to allow different address types without casts.
> It has the advantage of not needing wrapper macros. Any chance of
> using that instead? Or has that one been considered already and
> discarded?
That's aimed at a slightly different case, where the function knows what types
it can get. But that doesn't work for truly generic callbacks: the type is
completely controlled by the caller. ie. we want to allow whatever type
matches the arg.
Hope that clarifies,
Rusty.
next prev parent reply other threads:[~2008-08-01 3:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-31 4:52 [PULL] typesafe callbacks for kthread and stop_machine Rusty Russell
2008-07-31 14:06 ` Andi Kleen
2008-08-01 0:39 ` Rusty Russell [this message]
2008-08-01 14:28 ` Andi Kleen
2008-08-03 10:24 ` Rusty Russell
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=200808011039.30195.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=andi@firstfloor.org \
--cc=bert.wesarg@googlemail.com \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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