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

Michael Van Canneyt michael at freepascal.org
Fri Oct 12 22:00:33 CEST 2018

On Fri, 12 Oct 2018, Sven Barth via fpc-devel wrote:

> On 10/12/18 7:21 PM, Dmitry Boyarintsev wrote:
>> On Fri, Oct 12, 2018 at 1:07 PM Sven Barth via fpc-devel
>> <fpc-devel at lists.freepascal.org <mailto:fpc-devel at lists.freepascal.org>>
>> wrote:
>>     Dmitry Boyarintsev <skalogryz.lists at gmail.com
>>     <mailto:skalogryz.lists at gmail.com>> schrieb am Fr., 12. Okt. 2018,
>>     17:26:
>>         Maybe "Boolean8"  type should help instead? 
>>         David, could you please test with Boolean8 instead of ByteBool?
>>     Boolean8 is an alias to Boolean. But if you need to work with 1 and
>>     0, but have 4 Byte width then you could try Boolean32. 
>> Hmm, this is odd.
>> https://www.freepascal.org/docs-html/ref/refsu4.html
>> Boolean8, size=1, ord=1 
>> "In addition to the simple Boolean type, the additional Boolean8,
>> Boolean16, Boolean32 and Boolean64 types exist. There are in fact
>> integer types, which are assignment-compatible with the simple boolean
>> type. As an integer, the values for True and False are 1 and 0. This can
>> be used to interfac with C code that defines a boolean of this size with
>> values 0 and 1."
>> Boolean8 is not exactly an alias to Boolean, as it's expected to act as
>> an integer, rather than _Bool. (and would be expected? to be passed an
>> integer).
>> However, fpc 3.0.4 doesn't have Boolean8 as builtin type. Instead it
>> provides Boolean16+ only.  Maybe it's available in trunk only.
> 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. Look at the compiler
> sources, they are all implemented as pasboolSIZE, including Boolean. The
> documentation simply is *wrong* here.

What exactly is wrong ?

boolean8 has been removed from the docs some time ago after a bugreport. 
It should be online for 3.2

The statement about ord(true) being 1 is correct.

home:~/docs> fpc b1.pp
home:~/docs> ./b1
home:~/docs> cat b1.pp
   B16 : Boolean16;


So what is still wrong ?


More information about the fpc-devel mailing list