Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subject: gdb & BOOL



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:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.