[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: pack("l"), 64 bit question

Yukihiro Matsumoto

2/17/2006 2:13:00 AM

Hi,

In message "Re: pack("l"), 64 bit question"
on Fri, 17 Feb 2006 09:46:25 +0900, H.Yamamoto <ocean@m2.ccsnet.ne.jp> writes:

|Are these also unexpected?
|
|irb(main):009:0> [123].pack("s").unpack("l")
|=> [nil]
|irb(main):010:0> [123].pack("s").unpack("q")
|=> [nil]
|irb(main):011:0> [123].pack("l").unpack("q")
|=> [nil]

Wait, ... I see. "\377\377\377\377".unpack("l_") gives you nil
because it's shorter than sizeof(long) on the platform. So they are
all OK. Thank you.

Ocean, could you commit your patch?

matz.