Messages in this thread | | | Date | Wed, 2 Jun 2004 20:59:44 +0100 | From | viro@parcelfa ... | Subject | Re: [RFC PATCH] explicitly mark recursion count |
| |
On Wed, Jun 02, 2004 at 09:45:15PM +0200, Jörn Engel wrote: > On Wed, 2 June 2004 20:37:20 +0100, viro@parcelfarce.linux.theplanet.co.uk wrote: > > On Wed, Jun 02, 2004 at 08:58:32PM +0200, Jörn Engel wrote: > > > Note the "in the most general case" part. You can get things right if > > > you make some assumptions and those assumptions are actually valid. > > > In my case the assumptions are: > > > 1. all relevant function pointers are stuffed into some struct and > > > > Wrong. They are often passed as arguments to generic helpers, without > > being ever put into any structures. > > 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.
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. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |