On Thu, 12 Jul 2001, Henrik Nordstrom wrote:
> In an attempt to address this cbdataReferenceDone() was introduced,
> allowing code like
> 
> fooDone(...)
> {
>     void *cbdata;
>     ...
>     if ((cbdata = cbdataReferenceDone(mystate->calllback_data)) != NULL)
>         mystate->callback(..., cbdata);
> }
> 
> 
> which tries to join the best of both approaches.
Right. And in C++, you can write an even more consise and efficient
code:
fooDone(...)
{
        ...
        if (void *cbdata = cbdataAbandon(mystate->calllback_data))
                mystate->callback(..., cbdata);
}
Given the above, GCC may eliminate cbdata variable from existance and
there is no danger in using cbdata after it is passed on to a
callback. :)
Alex.
Received on Thu Jul 12 2001 - 11:29:26 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:07 MST