On Sun, Jan 18, 2004 at 02:50:10PM +0100 Tels wrote:

> On Sunday 18 January 2004 13:50, Tassilo von Parseval wrote:

> > Likewise when storing the pointer:
> >
> >     /* First make sure that the SV has a PV and NV slot;
> >        this implies IV */
> >     SvUPGRADE(x, SVt_PVNV);
> >     SvPVX = (char*) calc;
> 
> Cool, thanx. But I think the SV should already have the PV and NV slot, 
> because that is what I construted, right?

Probably, yes. When I work with multiple-typed scalars, I always do a
preliminary call to SvUPGRADE() because that way I can be sure that the
variable has all the available slots. Once I am sure I have them, I can
use the Sv..X macros such as

    SvIVX, SvNVX, SvPVX

They directly access the field in the C-structure without any type
checking in the hope that this will save a few picoseconds CPU time. I
think this is particularly useful when you want to 'abuse' one field to
hold a pointer. Any of perl's auto-transformation routines would only
be in the way.

> PS: Aachen, eh? Hoffe da ist auch Sonne :-)

Nee, jetzt ist es dunkel, und am Nachmittag schien es mir vornehmlich
grau zu sein.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval

Reply via email to