Garrett Goebel wrote:
> 
> Brian,
> 
> While reading perlguts, I ran across a note which runs counter to the
> examples listed in the Inline C Cookbook.
> 
> > In the SvPV macro, the length of the string returned
> > is placed into the variable len (this is a macro, so
> > you do not use &len). If you do not care what the
> > length of the data is, use the SvPV_nolen macro.
> > Historically the SvPV macro with the global variable
> > PL_na has been used in this case. But that can be quite
> > inefficient because PL_na must be accessed in
> > thread-local storage in threaded Perl.
> 
> SvPV(SV*, STRLEN len) is used throught the all the Inline C examples.
> 
> Is there a reason why SvPV_nolen should not be used instead?

It just appeared to me that SvPV_nolen isn't available with 5.005. 

I like to support 5.005 and 5.6 in my examples, so that's probably why I
never used it.

Brian

-- 
perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf
("Just Another %s Hacker",x);}};print JAxH+Perl'

Reply via email to