• 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
Re: BOOL attribute types.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BOOL attribute types.


  • Subject: Re: BOOL attribute types.
  • From: Alex Zavatone <email@hidden>
  • Date: Mon, 16 Feb 2015 16:20:34 -0500

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?

Thanks.

Sent from my iPad. Please pardon typos.

On Feb 16, 2015, at 4:13 PM, David Duncan <email@hidden> wrote:

>
>> On Feb 16, 2015, at 1:06 PM, Alex Zavatone <email@hidden> 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 (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
>
> --
> David Duncan
>

_______________________________________________

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


  • Follow-Ups:
    • Re: BOOL attribute types.
      • From: Akis Kesoglou <email@hidden>
References: 
 >BOOL attribute types. (From: Alex Zavatone <email@hidden>)
 >Re: BOOL attribute types. (From: David Duncan <email@hidden>)

  • Prev by Date: Re: BOOL attribute types.
  • Next by Date: Re: BOOL attribute types.
  • Previous by thread: Re: BOOL attribute types.
  • Next by thread: Re: BOOL attribute types.
  • Index(es):
    • Date
    • Thread