in reply to Re^3: SvUV vs SvIV for pointers in SVs, typemap
in thread SvUV vs SvIV for pointers in SVs, typemap

I disagree. One just needs to cast it back to a pointer before using it. The typemap does this.
  • Comment on Re^4: SvUV vs SvIV for pointers in SVs, typemap

Replies are listed 'Best First'.
Re^5: SvUV vs SvIV for pointers in SVs, typemap
by BrowserUk (Patriarch) on Feb 21, 2011 at 01:10 UTC
    One just needs to cast it back to a pointer before using it.

    This assumes that "one" is writing the code that is manipulating the pointers that are stored in, and manipulated as, SvIVs.

    Have you tried running Perl on a 32-bit system configured for /3GB?

    See also Re: Memory usage in Perl on Windows systems.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      The SV is not intended to be modifiable. It's just a container for an opaque value. The only "manipulation" being done is to cast the value back to a pointer.

      Have you tried running Perl on a 32-bit system configured for /3GB?

      No. Are you saying that sv = (SV*)(IV)sv fails then? If so, that's a bug. IV is guaranteed to be large enough to hold a pointer.

        You are still assuming that you (or "the programmer") would be in control of all the code that might operate upon pointer values stored within an SV.

        Ask yourself how and why a pointer value might end up in the IV slot of an SV.