I'm copying some XS code which does this:
| if (output == &sv_undef)
| output = sv_newmortal();
|
| if (!SvUPGRADE(output, SVt_PV))
| croak("cannot use output argument as lvalue");
What is the SvUPGRADE really trying to do?
I suspect that the croak() message is misleading, since SVt_PVness
doesn't appear to have anything to do with lvalueness. If I comment it
out, things still work unless output is undef (in which case, it SEGVs).
Should I be doing the SvUPGRADE only in the case where I create a new
SV? Russ Allbery's (unrelated) post on 2000-12-18, "Re: Attempt to free
unreference scalar?" suggests that this is the case (but doesn't explain
why).
Is there a searchable archive of the perl-xs mailing list anywhere?
- ams