Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: Managing C library memory in XS

by sundialsvc4 (Abbot)
on May 05, 2014 at 18:57 UTC ( [id://1085107]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Managing C library memory in XS
in thread Managing C library memory in XS

Not thinking so much of “blessed” anythings.   Instead, thinking of the exchange of (say, a “person”) consisting of a hash-type variable ... which might, say, include a “_personid” element provided by the library and which contains the moniker I spoke of.   Basically, you would be shifting data between C structures and hashes ... a lot ... if you pursued my suggestion.   Which, I will very freely admit, absolutely might not be the right thing for you to do in your case!   (I was wrong once ... lessee, how many years ago was it, now?   Or am I wrong about that ...?)   ;-)

As far as I know, the dual-value feature is basically there in the name of efficiency, so that you can have '123' and 123 at the same time.   But I am not qualified to answer your question about interpreter guarantees or the lack thereof.

Replies are listed 'Best First'.
Re^6: Managing C library memory in XS
by petermogensen (Sexton) on May 05, 2014 at 19:10 UTC

    As far as I know, the dual-value feature is basically there in the name of efficiency, so that you can have '123' and 123 at the same time. But I am not qualified to answer your question about interpreter guarantees or the lack thereof.

    Having dual values IV/PV is not so rare a use case. One example is error-codes. Many modules provide the error message in string context and the integer error code when using int().

    I also just found an example of PV/NV duality

    What my suggestion did was IV/NV duality. But with the little twist that the SVf_NOK flag was not set. It was for internal usage of back-referencing the owning object only. ... Who's using that NV slot anyway?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-19 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found