[fpc-devel] $MODE DELPHI quirks

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Nov 29 15:46:14 CET 2011


On 29 Nov 2011, at 15:39, Thaddy wrote:

> I ran into my own problem when writing a program in freepascal that  
> also should compile in Delphi (don't ask)
> Logically you would expect $mode delphi to enforce delphi  
> compatibility at the sourcecode level.
> But this is not the case if f.e. C style operators are used or  
> specified, or macro's.
> I accidentally used the former in my code.
> Shouldn't it be better if compatibility is enforced both ways?

Possibly, but it would also require RTL changes (the FPC system unit  
contains many types, constants, variables and functions that do not  
exist in Delphi -- and for programmers the difference between the  
language and the system unit is often not very clear) and possibly  
also blocking certain packages (which can't be compiled with Delphi).  
It would be a lot of work even if you would limit it to only the  
compiler (the use of which would be questionable), and additionally  
only few people are interested in such functionality.

For backwards compatibility reasons, such changes would have to go  
into a separate mode switch. Patches for that could be accepted, but  
again, without also changing the RTL and packages I'm not sure how  
much it would help you in reaching your goal.


Jonas

PS: please do not reply to existing messages when starting a new  
topic, it messes up threading both in mail clients and in web archives.



More information about the fpc-devel mailing list