in reply to Re^2: testing for undef in perl XS code (in DBD::ODBC)
in thread testing for undef in perl XS code (in DBD::ODBC)
Note that $undef is created (by 'create_undef()') with the value &PL_sv_undef, and that the 'is_defined()' function then tests to see whether $undef == &PL_sv_undef. Amazingly, 'is_defined()' reports that $undef != &PL_sv_undef (by stating that $undef is defined).use warnings; use strict; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'EOC'; SV * create_undef() { return newSVsv(&PL_sv_undef); } void is_defined(SV * x) { //x = &PL_sv_undef; x == &PL_sv_undef ? printf("Not defined\n") : printf("Defined\n") +; } EOC my $undef = create_undef(); is_defined($undef);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: testing for undef in perl XS code (in DBD::ODBC)
by salva (Canon) on Nov 06, 2007 at 17:19 UTC | |
by syphilis (Archbishop) on Nov 07, 2007 at 06:39 UTC |