YES and NO are considered Objective-C standard literals for BOOL . You will usually not find YES , NO or BOOL outside of the Objective-C source code. Note that these identifiers are actually macros defined in objc/objc.h
The identifiers true and false are standard C99 (as you noted) if you #include <stdbool.h> . Note that since you are using Objective-C, you probably include stdbool.h indirectly, even if you do not know it. For example, Foundation.h includes CoreFoundation.h , which includes stdbool.h . Thus, it is quite difficult to compile an iOS or Mac application without getting true and false .
The identifiers true and false are not standard. This is historical baggage identified by various libraries. Libraries may have been written before C99 or written after, but are designed to support pre-C99 compilers or simply written by authors unfamiliar with C99 boolean literals. On Mac, some examples of such libraries are Kerberos, XDR / RPC, and ncurses. Most importantly, Mach kernel headers define the constants true and false , and (as is the case with stdbool.h ) itβs quite difficult to avoid these specific definitions if you are building a modern application for iOS or Mac.
In all cases that I could find, true is defined as 1 or (1) , and false is defined as 0 or (0) .
(All the libraries I mentioned are the Mach core, which precedes C99, and is thus justified in defining its own Boolean constants.)
source share