in reply to Re^4: XS/Inline::C concat *any* two SVs.
in thread XS/Inline::C concat *any* two SVs.
#!/usr/bin/perl use strict; use warnings; use Inline C => <<'END_C'; void readonly(SV *sv) { SvREADONLY_on(sv); } END_C my $foo = "foo"; readonly($foo); # This dies with: # "Modification of a read-only value attempted at cat_readonly.plx lin +e 16." $foo .= "bar"; # unreachable: print "$foo\n";
So, if you have to deal with the possibility that your first scalar might be readonly, you have to do $a = $a . $b or its equivalent in XS rather than $a .= $b. It might be wasteful, but it's the only way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: XS/Inline::C concat *any* two SVs.
by BrowserUk (Patriarch) on May 28, 2006 at 15:20 UTC | |
|
Re^6: XS/Inline::C concat *any* two SVs.
by BrowserUk (Patriarch) on May 28, 2006 at 15:22 UTC | |
by creamygoodness (Curate) on May 28, 2006 at 15:30 UTC | |
by BrowserUk (Patriarch) on May 28, 2006 at 15:41 UTC | |
by creamygoodness (Curate) on May 28, 2006 at 15:46 UTC |