Silent failure for such trivial code. How can they claim high integrity?
with ada.text_io;
use ada.text_io;
procedure overflow is
procedure p (i: positive) is
x: integer := integer'last;
begin
x := (x+i)/2;
put_line (integer'image(x) & " should be positive");
end;
begin
p(10);
end;
Not even a compiler warning like "cannot ensure the lack of overflow" or smth.
This seems at least as error-prone as some of the C++ pitfalls the Ada folks like to point out. Correct me if I am wrong. I would like to have a better language than C++, but I keep facing language complexity that is supposed to protect from all pitfalls, and still.
NUMERIC_ERROR
atx+1
.