On Dec 12, 2004, at 3:12 AM, Sisyphus wrote:
SV * mysub(SV * a, SV * b, SV * three) { if(three == &PL_sv_yes) // return b-a
i believe what you really want it
if (three && SvTRUE (three))
SvTRUE() is true if the object is defined and true by the normal perl rules.
Problem was that *I* couldn't write any code (perl or XS) such that 'sv == &PL_sv_yes' was true. No matter how *I* was writing *my* code 'sv == &PL_sv_yes' was always returning false.
that's because PL_sv_yes is a statically-defined SV living off in the data segment someplace, and your pointers are on the heap or stack -- they will never match. SvTRUE() checks the sv for truth, which is probably what you want.
-- Without treatment, a common cold will last about seven days. With treatment, it will last about a week. -- conventional wisdom