Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: How to access the contents of a specific memory address?

by bulk88 (Priest)
on Jul 29, 2012 at 17:45 UTC ( #984302=note: print w/ replies, xml ) Need Help??


in reply to Re: How to access the contents of a specific memory address?
in thread How to access the contents of a specific memory address?

That's a feature, because it means you can't get segmentation fauls or bus errors if you stick to pure Perl code (no C code involved).

I disagree.

perl -e "print unpack('p', pack('J', 1))"


Comment on Re^2: How to access the contents of a specific memory address?
Download Code
Re^3: How to access the contents of a specific memory address?
by pat_mc (Pilgrim) on Jul 29, 2012 at 19:50 UTC
    Strange: When I try this, I get a segmentation fault. Am I overlooking some important detail?
    $ perl -e 'print unpack("p", pack("J", 1))' Segmentation fault
      Am I overlooking some important detail?

      Simple logic. :P

      Proposition: You can't get segfaults with pure Perl. Response: I disagree: code sample
        Not sure I am finding your response very helpful. At any rate I'll pass your comment on to my bash shell that generated the output I quoted.

        Why can't Perl give rise to a segmentation fault? And what then is the meaning of the system output the given line of code produces?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984302]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2014-09-19 13:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (138 votes), past polls