[fpc-devel] OSX: Setting up parameters to objc_msgSend()

Dmitry Boyarintsev skalogryz.lists at gmail.com
Fri Oct 12 22:54:51 CEST 2018

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.

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).

> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20181012/d6fbb920/attachment.html>

More information about the fpc-devel mailing list