Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.96k stars 555 forks source link

endianness description in perlfunc.pod #2397

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#3744 (status was 'resolved')

Searchable as RT3744$

p5pRT commented 24 years ago

From jdjohnston2@juno.com

There seems to be a goof in the description for "pack" in perlfunc.pod distributed with Perl 5.6.0. Following is a quote from the relevant section​:

=item *

The integer formats C\\, C\\, C\\, C\\, C\\, and C\
are inherently non-portable between processors and operating systems because they obey the native byteorder and endianness. For example a 4-byte integer 0x12345678 (305419896 decimal) [sic] be ordered natively (arranged in and handled by the CPU registers) into bytes as

0x12 0x34 0x56 0x78 # little-endian 0x78 0x56 0x34 0x12 # big-endian

Aren't the examples swapped? As I read them\, they are in the order one would find them in successive memory locations. Right?

Thanks for Perl! The more I use it\, the more I enjoy it. Jonathan D Johnston ________________________________________________________________ YOU'RE PAYING TOO MUCH FOR THE INTERNET! Juno now offers FREE Internet Access! Try it today - there's no risk! For your FREE software\, visit​: http​://dl.www.juno.com/get/tagj.

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

Jonathan D Johnston \jdjohnston2@​juno\.com writes​:

There seems to be a goof in the description for "pack" in perlfunc.pod distributed with Perl 5.6.0. Following is a quote from the relevant section​:

=item *

The integer formats C\\, C\\, C\\, C\\, C\\, and C\
are inherently non-portable between processors and operating systems because they obey the native byteorder and endianness. For example a 4-byte integer 0x12345678 (305419896 decimal) [sic] be ordered natively (arranged in and handled by the CPU registers) into bytes as

0x12 0x34 0x56 0x78 # little-endian 0x78 0x56 0x34 0x12 # big-endian

Aren't the examples swapped?

I think so too.

As I read them\, they are in the order one would find them in successive memory locations. Right?

Thanks for Perl! The more I use it\, the more I enjoy it. Jonathan D Johnston ________________________________________________________________ YOU'RE PAYING TOO MUCH FOR THE INTERNET! Juno now offers FREE Internet Access! Try it today - there's no risk! For your FREE software\, visit​: http​://dl.www.juno.com/get/tagj.

p5pRT commented 24 years ago

From @jhi

On Sat\, Aug 19\, 2000 at 02​:10​:39PM +0000\, Nick Ing-Simmons wrote​:

Jonathan D Johnston \jdjohnston2@​juno\.com writes​:

There seems to be a goof in the description for "pack" in perlfunc.pod distributed with Perl 5.6.0. Following is a quote from the relevant section​:

=item *

The integer formats C\\, C\\, C\\, C\\, C\\, and C\
are inherently non-portable between processors and operating systems because they obey the native byteorder and endianness. For example a 4-byte integer 0x12345678 (305419896 decimal) [sic] be ordered natively (arranged in and handled by the CPU registers) into bytes as

0x12 0x34 0x56 0x78 # little-endian 0x78 0x56 0x34 0x12 # big-endian

Aren't the examples swapped?

I think so too.

Fixed.

As I read them\, they are in the order one would find them in successive memory locations. Right?

Thanks for Perl! The more I use it\, the more I enjoy it. Jonathan D Johnston ________________________________________________________________ YOU'RE PAYING TOO MUCH FOR THE INTERNET! Juno now offers FREE Internet Access! Try it today - there's no risk! For your FREE software\, visit​: http​://dl.www.juno.com/get/tagj. -- Nick Ing-Simmons