Steve Hay <[EMAIL PROTECTED]> writes:
>Just a quick question:
>
>Is there a "preferred way" to return a Boolean value from an XSUB?

Return sv_yes or sv_no - that is what they are for ...

>
>I could have an SV* function returning &PL_sv_yes/&PL_sv_no (or 
>&PL_sv_undef?), or a bool function returning TRUE/FALSE, or even just an 
>int function returning 1/0.
>
>Is there any advantage in any of these?

Depends what the "consumer" of returned value is going to use it for.
But normal perl code is going to return sv_yes/sv_no so to make XSUB 
just like that use those.

In quasi-numeric contexts 1/0 (aka TRUE/FALSE) returned as SvIV may 
make more sense.


>
>Steve
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/

Reply via email to