Muppet <[EMAIL PROTECTED]> writes: > >of course, this is subject to subtleties like scratchpads and different >treatment of simple values and such, so i won't dare to say your code >is leaking, but in my own experience, i needed the sv_2mortal() to >avoid leaking scalars, especially references. perhaps nick could say >definitively. > >/me looks expectantly at nick
My posts are not "definitive" - the perl source is definitive. That said for sv_yes/sv_no mortalizing is not required and will cost "something" (but not much). As forgetting to mortalize returns is a common XS bug, there is some merit in doing the sv_2mortal() for "symetry". However for a boolean return I would be tend to use XSRETURN_YES / XSRETURN_NO which avoids the issue. One reason that might not suit is if you want 'no' to be '0' rather than ''. Which for quasi-numericals may be the case.