discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BOOL typedef in libobjc2


From: Derek Fawcus
Subject: Re: BOOL typedef in libobjc2
Date: Tue, 21 Dec 2021 22:28:53 +0000

On Wed, Nov 17, 2021 at 06:26:26PM +0100, Frederik Seiffert wrote:
> Hi all,
> 
> We noticed today that the BOOL type is defined [1] like this in libobjc2:
> 
> > #   ifdef STRICT_APPLE_COMPATIBILITY
> > typedef signed char BOOL;
> > #   else
> > #           if defined(__vxworks) || defined(_WIN32)
> > typedef  int BOOL;
> > #           else
> > typedef unsigned char BOOL;
> > #           endif
> > #   endif

So couldn't another option be added now, namely to define it as a native _Bool?

This is what Apples does on it's ARM based devices, at least according to the
"Treat BOOL Variables as Binary Values" sections of
   
https://developer.apple.com/documentation/apple-silicon/addressing-architectural-differences-in-your-macos-code

"As a rule, the Objective-C BOOL type has only two appropriate values: YES or 
NO. 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."

So at the C-level, it should now be a valid option to (somehow) have it defined
as a _Bool.

However that could well break existing code due to examples like that shown
at that link. Hence it may have to be something which can be controlled by
a flag/switch similar to the above.

DF



reply via email to

[Prev in Thread] Current Thread [Next in Thread]