• 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
Subject: gdb & BOOL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subject: gdb & BOOL


  • Subject: Subject: gdb & BOOL
  • From: Thomas Engelmeier <email@hidden>
  • Date: Wed, 30 Nov 2005 11:58:36 +0100

gdb seems to be interpreting BOOL types as pointers - in both the console and the variable viewer, they're being given as (for instance) 0x1000000.
bool types (note the lowercase) are interpreted normally, and appear as 'true' or 'false'.

What happens is pretty apparent if you look at the definitions of BOOL (defined in <objc/objc.h>) and Boolean (<Corefoundation/CFBase.h>).


Both are typedef'd as {un}signed char, so the debugger has no chance to display anything but contents of an char.

bool is an built in type for C++ and C99, so the debugger knows it can have two states (false, or 0 when assigned to another type, and true, or anything but 0 when assigned to another type).

If you need to use a mix of those representations, the fun starts with pointers and references. It will work if you cast Boolean <--> BOOL (which is an sign cast) , but never ever do that with bool <--> BOOL or bool <--> Boolean (sizeof( BOOL) = sizeof( char ), sizeof ( Boolean ) = sizeof( unsigned char ), sizeof( bool ) = sizeof( int )).

Anyone else experiencing this? Is there anything I can do to fix it?

Yes, No.

Regards,
	Tom_E
_______________________________________________
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: Subject: gdb & BOOL
      • From: Jonathan del Strother <email@hidden>
  • Prev by Date: ReL Three Level Dependencies between xcode projects still fails inXCode 2.2
  • Next by Date: Size of Binary
  • Previous by thread: Re: ReL Three Level Dependencies between xcode projects still fails inXCode 2.2
  • Next by thread: Re: Subject: gdb & BOOL
  • Index(es):
    • Date
    • Thread