[fpc-pascal] Lo

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jan 11 11:13:08 CET 2011


On 11 Jan 2011, at 10:38, Carsten Bager wrote:

> Is there a reason why the lo function returns the lo word from a  
> longint in FPC and not the lo
> byte as in Delphi.

It was decided/implemented before Delphi existed and when FPC's main  
goal was still to become a 32 bit alternative to Turbo Pascal. Maximal  
Borland compatibility was not as high on the list at the time as  
trying to "fix" the language where we believed Borland made a bad  
decision. Getting the lower word seemed (and still seems, to me at  
least) more logical and useful for longints than returning the lower  
byte, hence the decision.

Furthermore, lo() is implemented as an inline function in the system  
unit, which means that its result cannot differ depending on the  
language mode of the current source file. It could be changed into an  
internal compiler intrinsic so the behaviour differs for different  
syntax modes, but nobody has ever cared enough about this difference  
to make that change.

This and other similar differences are also documented at http://www.freepascal.org/port.var


Jonas



More information about the fpc-pascal mailing list