Is there a way, given a pointer address, to get back to the original
object? I’m thinking specifically of strings here.
irb(main):006:0> str = “hello”
irb(main):007:0> addr = [str].pack(‘p*’).unpack(‘l’)
Is there a way to go from that address back to “hello”? You can’t
simply reverse it:
ArgumentError: no associated pointer
It was pointed out to me that Ruby uses rb_str_associate and
rb_str_associated behind the scenes with regards to pack(‘p’), but I’m
also wondering about addresses for strings that weren’t obtained via
Or is this simply impossible?
This communication is the property of Qwest and may contain confidential
privileged information. Unauthorized use of this communication is
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
all copies of the communication and any attachments.