hmm.. Re: talloc issues
Jeremy Allison
jra at samba.org
Thu Jul 30 09:32:22 MDT 2009
On Thu, Jul 30, 2009 at 04:58:01PM +0930, Rusty Russell wrote:
> On Wed, 29 Jul 2009 02:17:00 am Jeremy Allison wrote:
> > +1. talloc_reference broke my brain a long time ago,
> > and I don't want to maintain any code that contains
> > it.
>
> There are patterns which require it; the clearest to me is the "cache"
> pattern where we want to keep an object around for later reuse, so we
> hand out references.
>
> Here's a trivial example:
Yes, that's very clever, but IMHO it's an example of
"too dangerous to use" design. What is going on with
the memory references is not obvious to a casual user
of the cache.
If you really want references like this, you should
be using a language that supports it by design. Yes,
I know C++ sucks, but it does solve this kind of thing
nicely :-).
Talloc_reference is "too clever to use" C programming.
Like multiple inheritance in C++, it's like a language
feature that will trip everyone up sooner or later :-).
All IMHO of course :-).
Jeremy.
More information about the samba-technical
mailing list