Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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
Replies are listed 'Best First'.
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 drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2015-07-08 06:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls