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

Re^5: How get PV address?

by dave_the_m (Monsignor)
on Aug 06, 2019 at 07:13 UTC ( [id://11104015]=note: print w/replies, xml ) Need Help??


in reply to Re^4: How get PV address?
in thread How get PV address?

You are using a typemap to create an SV to return to perl. That SV is being assigned an integer value. The only types of integer values that SVs can have are IVs and UVs. Hence a plain integer gets upgraded to an IV/UV before being assigned to the SV.

Dave.

Replies are listed 'Best First'.
Re^6: How get PV address?
by xiaoyafeng (Deacon) on Aug 06, 2019 at 08:31 UTC

    Hence a plain integer gets upgraded to an IV/UV before being assigned to the SV.

    That's what I thought before, but as above, in typemap, unsigned int also use sv_setnv function. Does it mean sv_setnv function wouldn't upgrade an IV to UV silently if it get a unsigned integer?




    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

      I don't understand why you are now talking about sv_setnv(): this doesn't appear in the typemap you showed above.

      The standard typemap for outputting integer values will do either sv_setiv($arg, (IV)$var) or sv_setuv($arg, (UV)$var) depending on whether the integer type is signed or not. The IV or UV types are usually defined as being the largest integer type that the compiler supports: they're large enough to hold a pointer, and often larger than a plain int (8 bytes versus 4 bytes).

      Dave.

        I don't understand why you are now talking about sv_setnv(): this doesn't appear in the typemap you showed above.

        Sorry, I mean sv_setuv.

        The standard typemap for outputting integer values will do either sv_setiv($arg, (IV)$var) or sv_setuv($arg, (UV)$var) depending on whether the integer type is signed or not. The IV or UV types are usually defined as being the largest integer type that the compiler supports: they're large enough to hold a pointer, and often larger than a plain int (8 bytes versus 4 bytes).

        Oh, I fully understand it! Thanks so much for your patient answer!





        I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-25 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found