in reply to Re^2: Is the documentation for Perl 5.20 'pack' correct?
in thread Is the documentation for Perl 5.20 'pack' correct?
Okay. I found a way to make it go away. Initialising out silences the warning:
#! perl -slw use strict; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'END_C', NAME => 'Endian', CLEAN_AFTER_BUILD =>0; SV *hexDump( UV in ) { int i; char *p = (char*)∈ SV *out = newSVpvn( "?", 1 ); for( i=0; i<8; ++i ) { sv_catpvf( out, "%02x", p[i] ); } return out; } END_C print hexDump( 72623859790382856 ); __END__ C:\test>endian ?0807060504030201
Which I guess means that the doc for newSVpvn() that reads:"If the s argument is NULL the new SV will be undefined. means something different to what I took it to mean.
This also works:
SV *hexDump( UV in ) { int i; char *p = (char*)∈ SV *out = newSVpvn( "", 0 ); for( i=0; i<8; ++i ) { sv_catpvf( out, "%02x", p[i] ); } return out; }
|
|---|