in reply to Re^3: simple XS
in thread simple XS

In real (production) code, you should also verify that you in fact have the appropriate types (using SvROK(), SvIOK(), etc.) before treating them as such

Yes, SvROK(*aref) should be checked, but checking SvIOK(*res) is not required because SvIV coerces.

#!/usr/bin/perl use Inline C => <<'EOC'; void show(SV* index) { PerlIO_printf(PerlIO_stdout(), "%d\n", SvIOK(index)); PerlIO_printf(PerlIO_stdout(), "%d\n", SvIV(index)); } EOC show("123456");
0 123456