On Sat, Apr 24, 2004 at 10:35:47AM +1000, Sisyphus wrote:
Nicholas Clark wrote:
eg. if I code:
$x = ~0;
then subsequently pass $x to an XS function, how does that function tell whether the argument it has just received holds the UV value ~0, or whether it's the IV value -1 ? (Given that it's quite valid to pass both signed and unsigned values to that function.)
5.6.0 introduced the SvIsUV() test, which will tell you whether you (really) have a UV. Prior to that the whole IV/UV thing in the core was educated guesswork on the part of the ops, which mostly worked.
What I think you're really looking for here are SvIOK_notUV() and SvIOK_only()
As you know, SvUOK() doesn't work on 5.6.1
SvIsUV() changes between 5.6.1 and 5.8.3 (for me on win32 at least).
I just tried SvIOK_notUV() expecting it to be identical to !SvUOK(), but that expectation seems also to be wrong :-)
I'll do some Devel::Peek::Dump()ing and try to work it out from there. It's starting to look a little complicated - which generally means it's time to review the overall approach to the problem. So I'll do that too.
At least I've got code that works on 5.6 and some different code that works on 5.8. If it gets too difficult, I'll just forget about 5.6 :-)
Thanks for the pointers, guys.
Cheers, Rob