On Thu, 3 Aug 2000, Nick Ing-Simmons wrote:

> Dan Sugalski <[EMAIL PROTECTED]> writes:
> >At 05:39 PM 8/2/00 +0100, Tim Bunce wrote:
> >>On Wed, Aug 02, 2000 at 12:05:20PM -0400, Dan Sugalski wrote:
> >> >
> >> > Reference counting is going to be a fun one, that's for sure.
> >> >
> >> > I'd like the interface to be something like:
> >> >
> >> >    stat = perl_get_value(sv *, int what, &destination)
> >>
> >>And what type is perl_get_value declared as returning?
> >
> >An integer--it is a status value after all...
> 
> Are we sure the value to be should not be returned and the status to be 
> the extra arg?
> 
> It is neater to be able to say 
>         
>    int err;
>    int circ = perl_get_value(radius_sv,PL_INTEGER,&err)*2*M_PI;
> 
> rather than:
> 
>    int radius;
>    int err = perl_get_value(radius_sv,PL_INTEGER,&radius);
>    int circ = radius*2*M_PI; 
>    
> Remember the compiler cannot put anything which has its address taken 
> in a register - so if the value is likely to be used in an expression 
> it is better to avoid forcing it to the stack.

The problem with that is that the value will be a variety of things--a
float, an integer, a char *, and so on, depending on what you're asking
for, so it sort of has to be a generic void * that's passed. The short-cut
functions could well return their type, but I'm loathe to have the two
different.

                                        Dan

Reply via email to