> Yeah.  Thanks.
> 
> What I'm asking is how can I identify the property as a BOOL when analyzing 
> property structures so that I can output "BOOL" to a descriptive string and 
> if I analyze a char, I can output "char" as a descriptive string.
> 
> Obviously, I can't use property_getAttributes() since it returns the same 
> values for BOOL and char.  
> 
> What options are available here to detect that a property declared as a BOOL 
> is a BOOL?
> 

objc.h typedefs BOOL as char/bool, as David says, so I don’t think you can 
infer that a property is BOOL by introspecting the property — you’ll always see 
char or bool.



> Thanks.
> 
> Sent from my iPad. Please pardon typos.
> 
> On Feb 16, 2015, at 4:13 PM, David Duncan <david.dun...@apple.com> wrote:
> 
>> 
>>> On Feb 16, 2015, at 1:06 PM, Alex Zavatone <z...@mac.com> wrote:
>>> 
>>> Xcode 5.1.1
>>> IOS 7.x
>>> 
>>> I'm messing with an auto description category for NSObjects with the 
>>> interest of dumping out a class's properties in the format of property 
>>> name, property class and string equivalent of property value.
>>> 
>>> I'm also considering supporting scalar primitive types that are not 
>>> NSObjects, such as CGRects, BOOLs and so on. 
>>> 
>>> In doing this, I'm checking the property's attributes with 
>>> property_getAttributes().
>>> 
>>> What is confusing here is that for properties that are declared as a non 
>>> atomic BOOL, the attributes are Tc,N,V, where c codes for a char, according 
>>> to the docs, according to the Runtime Property Attribute Description 
>>> Examples.
>>> 
>>> A char declared as a property returns exactly the same attributes as a BOOL 
>>> with property_getAttributes().
>>> 
>>> But for an NSString, property_getAttributes()returns "T@"NSString",&,N
>>> 
>>> It's easy to detect the NSString properties, but why isn't BOOL included in 
>>> a BOOL's property attributes?  Is a BOOL just a char (that's what this is 
>>> telling me)? What is going on under the hood here.  How can I properly 
>>> identify a BOOL and tell the difference between a BOOL and a char if they 
>>> are represented the same way?
>> 
>> On Mac OS X and 32-bit iOS targets, BOOL is a char, on 64-bit iOS targets 
>> its a C/C++ style ‘bool’.
>> 
>>> Thanks much,
>>> Alex Zavatone.
>>> 
>>> Sent from my iPad. Please pardon typos.
>>> _______________________________________________
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> 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:
>>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
>>> 
>>> This email sent to david.dun...@apple.com
>> 
>> --
>> David Duncan
>> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/akiskesoglou%40gmail.com
> 
> This email sent to akiskesog...@gmail.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to