develooper Front page | perl.perl5.porters | Postings from May 2004

Re: undef loses it magicness when assigned to a variable?

Thread Previous | Thread Next
From:
Tim Bunce
Date:
May 27, 2004 03:12
Subject:
Re: undef loses it magicness when assigned to a variable?
Message ID:
20040527101526.GB67341@dansat.data-plan.com
On Thu, May 27, 2004 at 01:21:33AM -0700, Stas Bekman wrote:
> 
> #line 451 "URI.c"
> 	char *	RETVAL;
> 	dXSTARG;
> 
> 	[...]
> 
> 	if (items < 2)
> 	    val = NULL;
> 	else {
> 	val = (char *)SvPV(ST(1), val_len);
> 	}
> 
> not only it's messed up formatting-wise, it should probably have the SvOK 
> in it and not issue:
> 
>   Use of uninitialized value in subroutine entry at
> 
> or may be it's a goodness that it does it.

I think it is.

> I suppose in order to allow 
> undefs to be passed as arguments, one has to change the prototype of the xs 
> function to accept SV* instead of char* and do the conversion manually.

Yeap.

Or add a typemap for the behaviour you want.

Tim.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About