Re: Dynamic getting of a property of BOOL type
Re: Dynamic getting of a property of BOOL type
- Subject: Re: Dynamic getting of a property of BOOL type
- From: Clark Cox <email@hidden>
- Date: Fri, 6 Mar 2009 11:38:03 -0800
On Fri, Mar 6, 2009 at 10:53 AM, Paul Sanders <email@hidden> wrote:
>> id value = objc_msgSend(object, propSelector);
>> BOOL booleanValue = (BOOL)value;
>
>> How can I properly convert this id returned from the dynamic
>> invocation of the property getter to the BOOL value that it actually is?
>
> Try BOOL booleanValue = (BOOL) (long) value;
>
> I believe this should also work on 64 bit. ++ (As would Nick's solution)
To put it bluntly, Nick's solution is the correct way to do this. Just
casting the return value may work for now, but there are no
guarantees.
--
Clark S. Cox III
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden