Re: BOOL parameter passed as nil object
Re: BOOL parameter passed as nil object
- Subject: Re: BOOL parameter passed as nil object
- From: Scott Ribe <email@hidden>
- Date: Tue, 19 Apr 2016 17:14:20 -0600
On Apr 19, 2016, at 2:20 PM, Alex Zavatone <email@hidden> wrote:
>
> Considering its use at the language level, would values of nil and 0 result as NO and every other value of 1 or > == YES?
No, when it's a char, there are 254 values which are not == to either NO or YES. This can be a pretty severe trap for the unaware. (Especially the part where multiples of 256 can become == NO...)
When it's a proper C99'ish bool, then all values are cast to bool at assignment, and so it is always == either 0 or 1.
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice
_______________________________________________
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