[fpc-devel] succ(byte)
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Sep 26 17:13:21 CEST 2013
On 26 Sep 2013, at 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).
At least http://www.freepascal.org/docs-html/ref/refsu5.html states
that it should generate a range check error, and so does http://delphi.about.com/od/objectpascalide/l/aa012500a.htm
("Note: If we try to use Succ when at the last element Delphi will
generate a run-time exception if the range checking is on.")
> This is not possible with the 2.6.2 compiler. Is there a reason for
> this.
The implementation of succ() may have been internally remapped on top
of another primitive which already had support for range checking. I
don't think it was a conscious decision, but it does seem correct to me.
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130926/4758faa5/attachment.html>
More information about the fpc-devel
mailing list