[fpc-pascal] Fwd: Delphi incompatible conditionals?

Marco van de Voort marcov at stack.nl
Fri Oct 1 19:52:36 CEST 2010


In our previous episode, Mark Daems said:
> I'm trying to add following conditional code to the top of a unit that
> should compile in fpc and in delphi:
> 
> 
> This seems to work well in fpc, however the delphi (7 and 2009)
> compiler complains on the {$IF ...} line.
> ? ? ?[DCC Error] Zeos.inc(49): E2026 Constant expression expected
> 
> Replacing the {$IF ...} line by
> ? ?{$IF Defined(fpc_version) and ((fpc_version>2) or (fpc_version=2)
> and (fpc_release>3))}

I also noticed that. Strange. (delphi XE btw)

> seems to solve the previous problem, however then the compiler outputs
> this warning 4 times for every occurence of this code:
> ? ? ?[DCC Warning] Zeos.inc(49): W1023 Comparing signed and unsigned
> types - widened both operands
> Because I want to use this code in an include file for every unit in
> the project this becomes very messy.

Try longint(3) and longint(2).
 
> 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?

I think it belongs on the Embarcadero buglist more than here. OTOH, they
will only fix it in the current or next version. So that's why I tried till
I got above workaround.

Still, it might be worth a report, otherwise stuff never gets fixed. And
that goes both for FPC and Delphi :-)



More information about the fpc-pascal mailing list