Talk:Val
From Lazarus wiki
Jump to navigationJump to search
RTE and exceptions
"The procedure val is so useful, since it does not trigger run-time errors or exceptions."
var
W: Word;
Code: Integer;
begin
{$R+}
W := 1234;
Val('65536',W,Code);
writeln('Code: ',Code);
writeln('W: ',W);
end.
Build and run:
An unhandled exception occurred at $004016E5: ERangeError: Range check error $004016E5
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)