From: Daniel Berger Date: 2006-06-23T02:06:26+09:00 Subject: Re: Using pack/unpack to go from string to address and back to string nobu@ruby-lang.org wrote: > Hi, > > At Wed, 21 Jun 2006 23:22:17 +0900, > Berger, Daniel wrote in [ruby-talk:198375]: > >> 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 >> pack('p*'). >> >> Or is this simply impossible? >> > > It's disallowed. If it were possible, you could get an illegal > "String." For instance: > > [1].pack('l').unpack('p*') > > Would it be possible to make an exception for strings (char pointers)? Or is there no way to determine the type of underlying object in time? Dan