Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9178275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:30:49+00:00 2026-06-17T17:30:49+00:00

Possible Duplicate: What values should I use for iOS boolean states? I believe there

  • 0

Possible Duplicate:
What values should I use for iOS boolean states?

I believe there are something like 5 boolean types in iOS environment (which comes from C, C++ and Objective C).

  • _Bool
  • bool
  • BOOL
  • boolean_t
  • Boolean

And there are at least four pairs of values for them:

  • true, false
  • TRUE, FALSE
  • YES, NO
  • 1, 0

Which one do you think is the best (style wise) to use for iOS Objective C development?

Update 1

I mentioned a type “boolean”. It looks like it doesn’t exist. I removed it from the list and added _Bool.

I am aware of typedef’s for these types and values. The question is about style differences.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:30:50+00:00Added an answer on June 17, 2026 at 5:30 pm

    iOS and OS X are mostly made of Cocoa, which use the boolean type BOOL with values YES/NO.

    bool
    • Defined by C++.
    • A true boolean, guaranteed to be 0 or 1.
    _Bool
    • Defined by C99.
    • A true boolean, guaranteed to be 0 or 1.
    • If stdbool.h is included, bool is #defined as _Bool.
    BOOL
    • Defined by the Objective-C runtime at /usr/include/objc/objc.h.
    • A signed char in 32 bit. Values may be YES (0x01), NO (0x00), or anything in the range -127 to 128. YES/NO are defined at <Foundation/NSObjCRuntime.h>.
    • A bool in 64 bits, guaranteed to be 0 or 1.
    Boolean
    • Defined by Carbon at CFBase.h.
    • An unsigned char.
    • Values may be TRUE (0x01), FALSE (0x00), or anything in the range -127 to 128.
    boolean_t
    • Defined by /usr/include/mach/i386/boolean.h
    • An int in x32 or unsigned int in x64.

    For non true boolean types:

    • Any non zero value is treated as true in logical expressions.
    • If you cast to a boolean types with less range than the casted type, only the lower bytes are used.

    Cases where one type or another makes a difference are hard to imagine. There are several cases where casting to BOOL may bite you, and some rare situations (eg: KVO converts BOOL to a NSNumber, and bool to a CFBoolean). If anything, when you consistently use BOOL, you are covered in case Apple changes its definition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Should I use uint in C# for values that can’t be negative?
Possible Duplicate: Compare multiple values in PHP I want to do something like this
Possible Duplicate: Concatenate row values T-SQL I have a table like this: ref_num name
Possible Duplicate: Concatenate Two NSDate String values Just confused that is there any default
Possible Duplicate: MySQL query using an array How to use an array of values
Possible Duplicate: Should I use Elements or Attributes in XML? I'm writing a configuration
Possible Duplicate: C++ When should we prefer to use a two chained static_cast over
Possible Duplicate: Error handling in C code What return value should you use for
Possible Duplicate: When should I use a List vs a LinkedList This question is
Possible Duplicate: When should I use a List vs a LinkedList If I expect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.