Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Re: Fun with duff's device and AUTOLOAD

by John M. Dlugosz (Monsignor)
on Feb 25, 2004 at 20:59 UTC ( #331811=note: print w/replies, xml ) Need Help??

in reply to Re: Fun with duff's device and AUTOLOAD
in thread Fun with duff's device and AUTOLOAD

I get "double 8" on ActiveState under win2k, yet the obfu doesn't work.

It does seem to have some issue with %c not working the same as printf, though. Printing 65 gives a nul character output, not 'A'. Printing 3.14 gives the bytes FD 91 BA B8 94 9F. Your print 2.14321574942828e-312, 2.29175545480573e-312; example prints "perl" as expected!

  • Comment on Re: Re: Fun with duff's device and AUTOLOAD

Replies are listed 'Best First'.
Re: Re: Re: Fun with duff's device and AUTOLOAD
by ambrus (Abbot) on Feb 25, 2004 at 21:41 UTC

    Maybe I wasn't clear in the explanation.

    $#="%c";print 65; should not print an A. It pushes 65.0 (a double) and "%x" on the C stack, and calls sprintf. Then sprintf sees "%c", so tries to pop an int from the stack. 65.0 is represented as the bytes (00 00 00 00 00 40 50 40)hex, but an int is just 4 bytes so it pops (00 00 00 00)hex which is 0 as an int so it prints a nul char. (On sparc, however, it will get (40 50 40 00)hex, which is 67437568, so it will either print a null character or a multibyte character sequence corresponding to unicode chr 67437568, depending on the version of Perl.)

    Dlugosz, I guess your cpu is an x86, correct me if it isn't.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://331811]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2018-05-24 14:16 GMT
Find Nodes?
    Voting Booth?