• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)


  • Subject: Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
  • From: Markus Hitter <email@hidden>
  • Date: Sun, 15 Jan 2006 09:04:45 +0100


Am 14.01.2006 um 09:27 schrieb Steve Christensen:

    union
    {
        char          bytes[8];
        unsigned long longs[2];
    } typeCreator;

    readFromPkgInfo(&typeCreator.bytes, 8);

The typeCreator.bytes would then contain

    'A' 'P' 'P' 'L' 'F' 'M' 'W' 'K'

[...] and on a little-endian Intel-based computer,

    typeCreator.longs[0] == 'LPPA'
    typeCreator.longs[1] == 'KWMF'

In short: 'A' 'P' 'P' 'L' != 'APPL'.

That's really odd. In fact I didn't believe it until I asked a friend to run a small test app on their Intel-based Linux machine. I'd have sweared endianess doesn't affect how bytes are sorted, but only how they are interpreted. I was wrong :-}


Thanks for clarification, Steve

Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/




_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
      • From: Steve Christensen <email@hidden>
References: 
 >Endian-ness of "PkgInfo" file (From: Kirk Kerekes <email@hidden>)
 >Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file) (From: Markus Hitter <email@hidden>)
 >Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file) (From: Steve Christensen <email@hidden>)

  • Prev by Date: Re: Hex Editor
  • Next by Date: Re: how to make c++ calls from cocoa to a dynamic library
  • Previous by thread: Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
  • Next by thread: Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
  • Index(es):
    • Date
    • Thread