-----BEGIN PGP SIGNED MESSAGE----- Moin,
perfectly working code (as far as former compiles, testsuite etc are concerned) now suddenly gets me warnings under a (neweer I assume) Perl: FastCalc.c: In function `XS_Math__BigInt__FastCalc__is_ten': FastCalc.c:480: warning: unused variable `class' FastCalc.c:482: warning: unused variable `RETVAL' Here is the XS function in question: SV * _is_ten(class, x) SV* class SV* x INIT: AV* a; SV* temp; CODE: a = (AV*)SvRV(x); /* ref to aray, don't check ref */ if ( av_len(a) != 0) { ST(0) = &PL_sv_no; XSRETURN(1); /* len != 1, can't be '10' */ } temp = *av_fetch(a, 0, 0); /* fetch first element */ ST(0) = boolSV((SvIV(temp) == 10)); Some comments: * "class" is ignored. I know this. Can I somehow flag this? * I read in perldoc perlxs about PPCODE RETVAL etc but I am confused. Which combination is the proper one? I tried void as return value in combination with PPCODE and CODE, as well as SV* and assigning to RETVAL. Some combination (I think the RETVAL one) triggers segfaults straighaway, while the other (void and PPCODE or CODE) seems (seems!) to work. And the current one emits a warning. So, which one is the right combination to use in this situation? * I have some routines which take only one, optional argument, "class". Unfortunately, XS code generated is always with a required argument,meaning I cannot call f.i. _one() from Perl, instead it must be _one($dummy). Is there a way to make arguments optional to XS routines just like for Perl? Thanx in advance, Tels - -- Signed on Sat Aug 14 09:20:41 2004 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email. "HOT PACKET ON SERVER ACTION! Click here for FREE ACCESS to streaming video of dirty packets penetrating badly-configured firewalls!!!" aanand (705284) on 2004-03-20 on /. about the Adult Bit and the Evil bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. iQEUAwUBQR2/HXcLPEOTuEwVAQGJ+Qf3RvLhJ8b4EJDACNXGydUI5wDRcD9ASgRJ YTbdp4A8lto5qaTYUvtplcKIRbHL40lAKZcotaykbYtDaZzp71qb50etJAhnD9nt 9N8t1mhwNyzufN2MbgV5+yzoG0nnzoUJn8lBx3IeSD/TaN65oU8UP8ZJI78yZfxe 37QUp/f7Wm0/JaCTSNg91CJceseKJUhcXn47AIb6k1PaVftaaLV3rcrX+GhLo9us FCxpTkPMQXEbgt4rf0VG3fxJFdAyThOw9xxzmHt/zcf0to0mWaO/YOjivgWxgd/1 f5vqdsVCMZ2BSS0fluAd3Zmvuk89em/6ke2N4IzUkPES6xYjqoV1 =ic13 -----END PGP SIGNATURE-----