in reply to Re: XS/Inline::C concat *any* two SVs.
in thread XS/Inline::C concat *any* two SVs.
he scalar is having its reference count dropped twice -- once when you leave the XS function, and once when @_ is cleaned up after that function returns.
Thankyou. That was the bit I was not getting.
The reason for wanting to handle the case of readonly inputs is that I cannot guarentee that the caller (should this ever get into the wild), won't pass a constant that becomes the first parameter.
The reason for wanting to return the argument is the same reason that I can do
print $scalar1 .= $scalar2;
I hate modules that force me to do
my $arg = 1; someMutator( $arg ); print $arg;
Instead of
print someMutator( 1 );
Try using Tk if its methods did not return the object:
my $widget = Tk::SomeWidget->new( ... ); $widget->Add( ... ); $widget->pack( ... );
Instead of
my $widget = Tk::SomeWidget->new( ... )->Add( ... )->pack( ... );
So, now I understand why the increment is necessary, can you clarify what is wrong (technically rather than preference), with doing an increment to counter one of the decrements?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XS/Inline::C concat *any* two SVs.
by dragonchild (Archbishop) on May 29, 2006 at 02:21 UTC | |
by BrowserUk (Patriarch) on May 29, 2006 at 04:12 UTC | |
|
Re^3: XS/Inline::C concat *any* two SVs.
by vkon (Curate) on May 28, 2006 at 22:13 UTC |