[fpc-devel] succ(byte)

Sven Barth pascaldragon at googlemail.com
Thu Sep 26 17:17:00 CEST 2013


On 26.09.2013 16:21, Carsten Bager wrote:
> Here is output from the 2.4.5 Compiler and the 2.62 compiler. of the following program
> compiled the same way.
>
> It has always been possible to eliminate runtime checking when incrementing a byte/word in
> this way (if one wants the byte to roll over).
> This is not possible with the 2.6.2 compiler. Is there a reason for this.

Range checking was simply missing for Succ/Pred before 2.6.0 and thus it 
was a bug that needed to be fixed. It happened in context of 
http://bugs.freepascal.org/view.php?id=16770

If you rely on this behavior you need to disable overflow and 
rangechecks for these code parts, e.g.:

=== code begin ===

begin
{$push}
{$Q-,R-}
   b := Byte(Succ(b));
{$pop}
end;

=== code end ===

Regards,
Sven



More information about the fpc-devel mailing list