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.