in reply to Re: SvUV vs SvIV for pointers in SVs, typemap
in thread SvUV vs SvIV for pointers in SVs, typemap
If you cast the pointer to some int type, pointer arithmetic will be wrong whether it's signed or not.
use Inline C => <<'__EOI__'; int test() { SV* sv = &PL_sv_undef; printf("%p\n", sv+2); printf("%p\n", ((IV)sv)+2); printf("%p\n", ((UV)sv)+2); } __EOI__ test();
0x746310 0x7462e2 0x7462e2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: SvUV vs SvIV for pointers in SVs, typemap
by BrowserUk (Patriarch) on Feb 20, 2011 at 21:26 UTC | |
by ikegami (Patriarch) on Feb 20, 2011 at 23:12 UTC | |
by BrowserUk (Patriarch) on Feb 21, 2011 at 01:10 UTC | |
by ikegami (Patriarch) on Feb 21, 2011 at 01:32 UTC | |
by BrowserUk (Patriarch) on Feb 21, 2011 at 01:47 UTC | |
|