Should BOOL and bool be different types in Objective-C++?

I have an overloaded function, one version with a BOOL parameter and one with a bool parameter. It gives me a redefinition error when compiling for Apple Silicon but not when compiling for Intel.

Answered by Scott in 774940022

This is mentioned in the Apple silicon porting guide:

On Apple silicon, the compiler defines the BOOL type to be a native bool, but on Intel-based Mac computers, it is a signed char.

But even though it works on Intel, I’d suggest that overloading that way could result in a confusing and error-prone API.

Accepted Answer

This is mentioned in the Apple silicon porting guide:

On Apple silicon, the compiler defines the BOOL type to be a native bool, but on Intel-based Mac computers, it is a signed char.

But even though it works on Intel, I’d suggest that overloading that way could result in a confusing and error-prone API.

Should BOOL and bool be different types in Objective-C++?
 
 
Q