in reply to SvUV vs SvIV for pointers in SVs, typemap
There's no such thing as a SvUV. A ref can be in practically any type of SV (at least SvIV, SvNV, SvPV, SvPVIV, SvPVNV).
>perl -MDevel::Peek -e"my $x = {}; Dump($x);" SV = IV(0x3269b8) at 0x3269c0 REFCNT = 1 FLAGS = (PADMY,ROK) ... >perl -MDevel::Peek -e"my $x = 'abc'; $x = {}; Dump($x);" SV = PV(0x33abe0) at 0x2a69d0 REFCNT = 1 FLAGS = (PADMY,ROK) ... >perl -MDevel::Peek -e"my $x = 'abc'; $x = 123; $x = {}; Dump($x);" SV = PVIV(0x28da78) at 0x2a6a60 REFCNT = 1 FLAGS = (PADMY,ROK) ...
A reference is indicated by the ROK flag. The pointers of references are neither IV nor UV. The pointers are returned as SV* as they should. The actual pointer is located in the same location as an IV's number or UV's number, so ROK && IOK is impossible.
Update: It appears possible to have an SV that is both ROK and IOK. It would have to be hand-crafted; Perl never constructs one. No idea if it's safe to construct one.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SvUV vs SvIV for pointers in SVs, typemap
by ikegami (Patriarch) on Feb 20, 2011 at 21:13 UTC |