discuss-gnustep
[Top][All Lists]
Advanced

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

Re: BOOL typedef in libobjc2


From: Frederik Seiffert
Subject: Re: BOOL typedef in libobjc2
Date: Thu, 18 Nov 2021 10:25:54 +0100

So I found why BOOL declared as int on Windows – I guess we’ll have to find 
ways to deal with this in our code:

> BOOL  A Boolean variable (should be TRUE or FALSE).
> This type is declared in WinDef.h as follows:
> typedef int BOOL;

I think this also explains this failing test on the Windows CI, we’ll probably 
have to adapt the test for Windows:

> Failed test:    basictypes.m:157 ... can unarchive BOOL from 
> D:/a/libs-base/libs-base/source/Tests/base/coding/BOOL-1.type


Still curious though why GNUstep is using "unsigned char" instead of "signed 
char" like on Apple platforms...

Frederik


> Am 17.11.2021 um 18:26 schrieb Frederik Seiffert <frederik@algoriddim.com>:
> 
> 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
>> 
> 
> 
> Can anyone explain the reasoning behind the different types for the different 
> platforms, and why it’s not just using signed char like on Apple platforms? 
> I’m especially wondering about why the int type is used on Windows, as it’s 
> messing with some code of ours.
> 
> Is there any downside to defining STRICT_APPLE_COMPATIBILITY?
> 
> Thanks!
> Frederik
> 
> 
> [1] 
> https://github.com/gnustep/libobjc2/blob/bdf03cb55da14943c8add1c45db7b5a93b656d59/objc/runtime.h#L122-L133




reply via email to

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