http://www.perlmonks.org?node_id=928024


in reply to Re^2: XS: returning a 64-bit unsigned int?
in thread XS: returning a 64-bit unsigned int?

Right, but shouldn't newSVuv make a UV and not an IV? Talk about false advertising :)
  • Comment on Re^3: XS: returning a 64-bit unsigned int?

Replies are listed 'Best First'.
Re^4: XS: returning a 64-bit unsigned int?
by BrowserUk (Patriarch) on Sep 27, 2011 at 07:08 UTC
    shouldn't newSVuv make a UV and not an IV? Talk about false advertising :)

    I concur completely. But you think that ones bad, what d'ya think newSVrv( rv ) does?


    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.
Re^4: XS: returning a 64-bit unsigned int?
by ikegami (Patriarch) on Sep 27, 2011 at 07:21 UTC

    Perl claims the right to convert among equivalent representations. It's an optimisation that an UV isn't used unless needed since UVs require extra handling.

    >perl -MDevel::Peek -e"Dump(0x7FFFFFFF)" SV = IV(0x1de9d00) at 0x1de9d04 REFCNT = 1 FLAGS = (PADTMP,IOK,READONLY,pIOK) IV = 2147483647 >perl -MDevel::Peek -e"Dump(0x80000000)" SV = IV(0x4a9d00) at 0x4a9d04 REFCNT = 1 FLAGS = (PADTMP,IOK,READONLY,pIOK,IsUV) UV = 2147483648