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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to