Subject: gdb & BOOL
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