Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: XS: how to destroy HV* that was used internally?

by OlegG (Monk)
on Sep 18, 2014 at 08:43 UTC ( [id://1101016]=note: print w/replies, xml ) Need Help??


in reply to Re: XS: how to destroy HV* that was used internally?
in thread XS: how to destroy HV* that was used internally?

Thank you!
Also found that for me it works without type casting. But, ok, I'll use it
And after all I found similar question on stackoverflow with similar answer.
  • Comment on Re^2: XS: how to destroy HV* that was used internally?

Replies are listed 'Best First'.
Re^3: XS: how to destroy HV* that was used internally?
by ikegami (Patriarch) on Sep 18, 2014 at 14:07 UTC

    That's because SvREFCNT_dec already casts for you. In fact, it casts in a way that will detect if the input was const, so doing SvREFCNT_dec((SV*)hv) instead of SvREFCNT_dec(hv) is actually harmful.

    If you ever use (SV*)x, consider using MUTABLE_SV(x) instead.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1101016]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-24 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found