At 15:36 19/07/2001, Marc Boeren wrote:

> > >(*actual_ptr)->refcount++;
> > >(*actual_ptr)->is_ref =1;
>
> > (a) You only have to set is_ref once.
>
>I only set it once... or is increasing the refcount enough?

No, if you just increase refcount and is_ref is not set, the values will 
not be referenced to each other (i.e., changing one won't change the other).

> > (b) If you don't increase the refcount, the behavior is
> > undefined, and is likely to end up crashing PHP.
> > Not increasing refcount may actually give
> > you the same behavior as setting is_ref to 1, but it would
> > crash, sooner or later.
>
>What I meant was, without setting _either_ refcount or is_ref (so only the
>hash_update call), it still works with no mem loss.

It's not supposed to work, you may be lucky, but chances are it'd crash.

>So, do I need just the refcount++, or the is_ref=1 as well?

If you want the values to be connected to each other (changing one will 
change the other), you need to set is_ref to 1.  Otherwise, you don't.  In 
any case, you must update the refcount.

Zeev


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to