From Free Pascal wiki
Revision as of 23:03, 20 March 2019 by Bart (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

RTE and exceptions

"The procedure val is so useful, since it does not trigger run-time errors or exceptions."

  W: Word;
  Code: Integer;
  W := 1234;
  writeln('Code: ',Code);
  writeln('W: ',W);

Build and run:

An unhandled exception occurred at $004016E5:
ERangeError: Range check error

See Issue #0015633
--Bart (talk) 18:06, 20 March 2019 (CET)

Yeah, acknowledged, but the sentence states, that the procedure itself does not trigger RTEs or exceptions. Of course you can insert, you can instruct the code generator to insert range checks, but that's not part of val's implementation, is it? Kai Burghardt (talk) 18:18, 20 March 2019 (CET)
That's a bit weird reasoning. Accessing an array with an index out of bounds also does not by itself trigger a RTE or exception. It's an error nevertheless, which is revealed if you do range checking. --Bart (talk) 22:03, 20 March 2019 (CET)