[fpc-pascal] LongWord
Jonas Maebe
jonas.maebe at elis.ugent.be
Mon May 7 17:44:09 CEST 2007
On 7 mei 2007, at 15:14, Bernd Mueller wrote:
>> See http://www.freepascal.org/mantis/view.php?id=8321 for a long
>> discussion on this topic.
> I think I have hit a similar case with the following code:
>
> {$mode objfpc}{$H+}
> program test; { FPC 2.0.4}
> var
> w: Word;
> begin
> w:= 5555;
> if lo(w) <> lo(w + (5 - 5)) then
> writeln('This is a little bit unexpected');
> end.
>
> What would you suggest as a "workaround"? Using the mod operator?
Yes, or using byte()/word(), or typecasting the result of the
calculation. The result of lo/hi depends on the type of the expression.
Jonas
More information about the fpc-pascal
mailing list