perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: C question (was Re: [mp2] Our API is not perl thread-safe)
Date Mon, 28 Mar 2005 22:58:32 GMT
Stas Bekman wrote:
> Joe Orton wrote:
> 
>> On Sun, Mar 27, 2005 at 08:06:39PM -0500, Stas Bekman wrote:
>>
>>> My problem is that I can't see how can I stick a call to 
>>> MP_CLONE_INSERT_OBJ() inside the mp_xs_APR__Pool_2obj(ptr) wrapper. 
>>> Since it's usually used as:
>>>
>>>  RETVAL = mp_xs_APR__Pool_2obj(ptr);
>>>
>>> Is there some C trick to have multiple statements in the macro so it 
>>> can be an rvalue? something like:
>>>
>>>  RETVAL = do { MP_CLONE_INSERT_OBJ(ptr);  mp_xs_APR__Pool_2obj(ptr) };
>>
>>
>>
>> RETVAL = ( stmt1, stmt2, rvalue );
>>
>> will do what you're looking for, I think.
> 
> 
> Yup, and it works for complex block statements too! I just hope that 
> this is works everywhere.
> 
> Thanks a lot, Joe!

it seems that this trick won't work for us, as I need to return a value 
created inside that macro:

#define C(x)                                    \
     (STMT_START {                               \
         int y = x;                              \
     } STMT_END, y )

and 'y' is undefined.

Oh well, I'll see if we can use inlined functions instead.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message