[fpc-devel] OSX: Setting up parameters to objc_msgSend()
Sven Barth
pascaldragon at googlemail.com
Sat Oct 13 00:48:06 CEST 2018
Dmitry Boyarintsev <skalogryz.lists at gmail.com> schrieb am Fr., 12. Okt.
2018, 22:55:
> On Fri, Oct 12, 2018 at 3:51 PM Sven Barth via fpc-devel <
> fpc-devel at lists.freepascal.org> wrote:
>
>> All the Pascal Boolean types are not "Integer types". You can't assign
>> any of them to a Integer or whatever without typecasting. They *all*
>> behave like Boolean, because that was the way they were added. They are
>> all 1-bit zero extended to the specified size.
>
> It's true for pascal sources, but the issue is not with pascal, but rather
> interfacing C-world (where before C99 boolean didn't quite exist).
> And the whole family of boolean types (if the documentation can be
> trusted) was introduced for this whole purpose.
>
Not quite: the Boolean16, Boolean32 and Boolean64 types were introduced
because the libraries provided by GTK required a 4-Byte boolean type that
worked like Object Pascal's Boolean. Until then only Boolean and the *Bool
types existed (and in Delphi that is still true). And Boolean exists this
way because it existed this way in Turbo Pascal.
> Documentation itself lays out pretty structured and consistent layout:
> BooleanX - indicates a boolean of a size N-bits, and if the value is
> requested, it would be translated to either 0 or 1.
> NNNNBool - indicates a boolean of a sizeof(NNNN), and if the value is
> requested, it can be anything that is non zero.
>
> But since the documentation is wrong, I believe there's no consistency,
> and everything is pretty much target dependent. (and it's sad).
>
It's not target dependent, it works the same on all platforms that FPC
supports.
Also the documentation is now going to be revised as the meaning should
have been that these Boolean types are *ordinals* not *integers*.
>
>> Now for the problem at hand the question is either if the ABI is
>> implemented incorrectly or that a new kind of Boolean type is required
>> to correctly represent the _Bool type needed by Objective C.
>>
> I do not believe that it is Objective-C specific issue.
> Declared BOOL macro can be used in a plain C-function call and would have
> the exact side effect.
> (Apple puts it a special consideration
> https://developer.apple.com/documentation/objectivec/bool)
>
Then maybe it's an issue about the ABI (maybe all values with a size < 4
need to be correctly extended due to the ABI).
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20181013/f9668e97/attachment.html>
More information about the fpc-devel
mailing list