That would be closer to
sub SvPVX { unpack 'J', pack 'p', $_[0] } if (defined $y) { if (length($y)) { printf("Defined loc=%X, val='%s'\n", SvPVX($y), $y); } else { printf("Empty string: loc=%X\n", SvPVX($y)); } } else { printf("Undefined (null ptr)\n"); }
So you completely removed the case the OP was asking about.
The C equivalent would be closer to the following (memory leak aside):
Scalar* stringify(Scalar* sv) { if (scalar_type(sv) == undefined) { fprintf(STDERR, "Use of unitialised value\n"); return NewEmptyStringScalar(); } else if (scalar_type(sv) == string) { return sv; } else if (scalar_type(sv) == ...) { ... } else ... } int eq(Scalar* sv1, Scalar* sv2) { return strcmp( stringify(sv1)->string_buffer, stringify(sv2)->string_buffer ) == 0; }
In reply to Re^2: defined vs null string
by ikegami
in thread defined vs null string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |