Re: Any way to get a warning if a non-boolean type is used in an if expression?
Re: Any way to get a warning if a non-boolean type is used in an if expression?
- Subject: Re: Any way to get a warning if a non-boolean type is used in an if expression?
- From: Luther Baker <email@hidden>
- Date: Thu, 17 Oct 2013 22:53:40 -0500
I keep seeing "BOOL type" thrown around like it is a first class citizen.
Is it not a typedef ... a signed char maybe? See objc.h ...
Are we essentially asking for a warning every time an truthy clause isn't using a "signed char"? Can the current implementation of clang distinguish an explicit BOOL clause from its bitwise identical cousins?
---
objc.h
#define OBJC_BOOL_DEFINED
/// Type to represent a boolean value.
#if !defined(OBJC_HIDE_64) && TARGET_OS_IPHONE && __LP64__
typedef bool BOOL;
#else
typedef signed char BOOL;
// BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C"
// even if -funsigned-char is used.
#endif
#if __has_feature(objc_bool)
#define YES __objc_yes
#define NO __objc_no
#else
#define YES ((BOOL)1)
#define NO ((BOOL)0)
#endif
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden