[fpc-devel] how to get same pthreads code to compile between Linux and FreeBSD

Sven Barth pascaldragon at googlemail.com
Sun Feb 3 14:22:24 CET 2013


On 03.02.2013 14:16, Marco van de Voort wrote:
> In our previous episode, Sven Barth said:
>> In this case the return type of "@s" will be "^sem_t" instead of
>> "Pointer" and then the compiler will find the correct method.
>>
>> Now one might nevertheless ask the question why the compiler considers
>> the var variant with an "@s" valid at all? Maybe this is a bug indeed...
>
> Afaik Delphi allows that too since D4. It was one of the things 1.0.x
> couldn't do, but 1.9+ could.

But if the overload with the "psem_t" is removed the "var" variant 
doesn't compile either:

=== output begin ===

Free Pascal Compiler version 2.6.0 [2011/12/23] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling vartest.pas
vartest.pas(22,14) Error: Can't assign values to an address
vartest.pas(24) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /mnt/data/applications/fpc/2.6.0/bin/ppc386 returned an error 
exitcode (normal if you did not specify a source file to be compiled)

=== output end ===

So my personal opinion is still that this is a bug...

Regards,
Sven



More information about the fpc-devel mailing list