On Nov 7, 2005, at 6:32 PM, Daniel Berger wrote:

> Jeremy Kemper wrote:
>> On Nov 7, 2005, at 5:57 PM, Daniel Berger wrote:
>>> [0x31].pack("v")
>>
>> ruby 1.8.2 (2004-12-25) [powerpc-darwin8.2.0]
>>
>> irb(main):001:0> [0x31].pack("v")
>> => "1\000"
>>
>> jeremy
>
> One email I've received says this:
>
> TiBook-5:~ xdefrang$ uname -a
> Darwin TiBook-5.local 8.3.0 Darwin Kernel Version 8.3.0: Mon Oct  3
> 20:04:04 PDT 2005; root:xnu-792.6.22.obj~2/RELEASE_PPC Power Macintosh
> powerpc
>
> result: "\0001"
>
> So, I'm quite confused.

I cane get you both on the same machine:

$ uname -a
Darwin kaa.jijo.segment7.net 8.3.0 Darwin Kernel Version 8.3.0: Mon  
Oct  3 20:04:04 PDT 2005; root:xnu-792.6.22.obj~2/RELEASE_PPC Power  
Macintosh powerpc
$ ruby168 -ve 'p [0x31].pack("v")'
ruby 1.6.8 (2002-12-24) [powerpc-darwin8.2.0]
"1\000"

I built this Ruby by hand.

$ ruby182-orig -ve 'p [0x31].pack("v")'
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
"\0001"

This one came with Tiger, and I didn't install that gem patch.

$ ruby183 -ve 'p [0x31].pack("v")'
ruby 1.8.3 (2005-09-21) [powerpc-darwin8.2.0]
"1\000"

I built this Ruby by hand too.

I wonder if this has anything to do with it:

$ ruby182-orig -v -rrbconfig -e 'p Config::CONFIG["CFLAGS"]'
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
"-arch i386 -arch ppc -g -Os -pipe -fno-common -arch i386 -arch ppc - 
pipe -pipe -fno-common"
$ ruby183 -v -rrbconfig -e 'p Config::CONFIG["CFLAGS"]'
ruby 1.8.3 (2005-09-21) [powerpc-darwin8.2.0]
"-g -O2 -pipe -fno-common"

Does cross-compilation affect the endianness of ruby?

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04