• 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: Weird inline/struct offset problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird inline/struct offset problem


  • Subject: Re: Weird inline/struct offset problem
  • From: Eric Albert <email@hidden>
  • Date: Wed, 16 Aug 2006 12:48:39 -0700

While I don't have a solution for the problems you've described, I do have a few comments....

On Aug 16, 2006, at 12:09 PM, Allen Cronce wrote:

We've got a cross platform, legacy C++ static library that uses a 'BOOL'
type. For Windows, this is a standard type defined as an int. For Mac,
we define it as a 'bool'.

'BOOL' unfortunately is not the same as 'bool' on the Mac. On PowerPC, 'bool' is four bytes, but BOOL is an unsigned char. On Intel, 'bool' is one byte, but I can't remember if it's signed or unsigned.


As far as working around the problem, I suppose I could try using the
"Use One Byte 'bool'" option. That would automatically match our legacy
library's BOOL definition to the same size as Objective C. But the rub
is that "bool" is used something like 12,000 times in the system
frameworks, so there's lots of opportunity for our binary to "disagree"
with the frameworks.

Keep in mind that this is the default for Intel (and there's no flag to change it to four bytes), so you'll have to be able to work with one-byte bools to be able to run on Intel.


I really wish that Apple (or rather Next) had never redefined the
Windows BOOL type. It's been a big pain and a drag on our ability to use
Objective C.

For what it's worth, we don't have much control over the types Microsoft chooses. It would've been better all around if both Microsoft and NeXT had chosen types defined in the C standard, much as it's often better today to use C99's fixed-size types like uint32_t.


-Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Weird inline/struct offset problem
      • From: Philippe Casgrain <email@hidden>
    • Re: Weird inline/struct offset problem
      • From: Allen Cronce <email@hidden>
References: 
 >Weird inline/struct offset problem (From: Allen Cronce <email@hidden>)

  • Prev by Date: Re: Undefined Symbols when linking global logging function
  • Next by Date: Where are tabs in xCode 3.0 ?
  • Previous by thread: Weird inline/struct offset problem
  • Next by thread: Re: Weird inline/struct offset problem
  • Index(es):
    • Date
    • Thread