Re: [RFC PATCH] explicitly mark recursion count

From: Jörn Engel
Date: Thu Jun 03 2004 - 02:02:47 EST


On Wed, 2 June 2004 20:59:44 +0100, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> >
> > Ok. Would it be ok to use the following then?
> >
> > b1. Function pointer are passed as arguments to functions and
> > b2. those pointer are called directly from the function, they are
> > passed to.
>
> Again not guaranteed to be true - they can be (and often are) passed further.

Hmm. If that happens, I'm out of ideas for now. Cannot do more than
give a warning.

> Moreover, they are also stored untyped in structures. Common pattern
> is
> foo.callback = f;
> foo.argument = p;
> iterate_over_blah(blah, &foo);
>
> Note that here f is the only thing that will see the value of p _and_ the
> only thing that cares about type of p. iterator itself doesn't care and
> can be used for different types.

Those cases I should already catch. If foo is of type "struct bar",
"bar.callback" will be the function name for a pseudo-function. That
function is called by iterate_over_blah and calls f. Unnamed struct
get a name made up from the components of the struct, like
____FAKE.Name.Chip.stat.Regi.LILP.Opti.high.lowe->ProcessIMQEntry.
Doesn't look pretty, but works.

Jörn

--
Time? What's that? Time is only worth what you do with it.
-- Theo de Raadt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/