[fpc-pascal] Re: Delphi incompatible conditionals?
Mark Daems
mdaems at advalvas.be
Sun Oct 3 20:50:26 CEST 2010
> From: "Juha Manninen (gmail)" <juha.manninen62 at gmail.com>
> To: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
> Date: Fri, 1 Oct 2010 20:04:18 +0300
> Subject: Re: [fpc-pascal] Fwd: Delphi incompatible conditionals?
> On Friday 01 October 2010 19:33:48 Mark Daems wrote:
>> ...
>> And it's a weird behaviour, because it's all within an {$IFDEF FPC}
>> construct. Why does delphi even try to interprete it?
>>
>> Somebody knows how to avoid the problem?
>
> Try this instead:
>
> {$IFNDEF FPC}
> // Can be empty
> {$ELSE}
> ...
> {$ENDIF}
>
> I got feedback for the Delphi converter in Lazarus about this same problem.
> Now the converter always adds IFNDEF instead of IFDEF to the code.
>
> Juha
Sorry Juha,
This doesn't help at all. Delphi keeps trying to interprete all {$IF
...} conditions in the file, even if it doesn't make sense because of
surrounding conditions.
> From: marcov at stack.nl (Marco van de Voort)
> To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
> Date: Fri, 1 Oct 2010 19:52:36 +0200 (CEST)
> Subject: Re: [fpc-pascal] Fwd: Delphi incompatible conditionals?
> In our previous episode, Mark Daems said:
...
> Try longint(3) and longint(2).
>
How should I do that? The place where the file containing the
conditions is included doesn't allow for defining constants as it's
the very first line in the unit code. Even before the uses clause in
the interface section. Actually the problem is Delphi doesn't find the
constant definitions, so it's guessing the data type of fpc_version
and fpc_release.
> Still, it might be worth a report, otherwise stuff never gets fixed. And
> that goes both for FPC and Delphi :-)
This isn't an FPC bug at all. FPC handles this exactly as expected.
Unless they invent some new FPC only version checking directive
allowing for syntax like {$IFVERSION < 2.4}...{$ENDIFVERSION},
{$IFVERSION 2.4}...{$ENDIFVERSION} and {$IFVERSION
2}...{$ENDIFVERSION}
That would solve the Delphi problem completely as no {$IF} with
constants is involved anymore. Provided you can make sure all old fpc
versions get this behaviour as well. Which brings us back to ...
impossible to solve.
Thanks for trying to resolve this issue, but I think I'll add the
checks to the top of the fpc packages files. In that case only Lazarus
will see them, but people using the units directly in fpc will not get
the message...
Mark
More information about the fpc-pascal
mailing list