Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!mimsy!tove.cs.umd.edu!stuartw From: stuartw@tove.cs.umd.edu (Stuart M. Weinstein) Newsgroups: comp.lang.ada Subject: Updating IN OUT's after exceptions Message-ID: <33747@mimsy.umd.edu> Date: 30 Apr 91 09:18:41 GMT Sender: news@mimsy.umd.edu Reply-To: stuartw@tove.cs.umd.edu (Stuart M. Weinstein) Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 56 In the enclosed program, I raise an exception inside a subroutine after making an assignment to an IN OUT parameter. In the first case, the parameter is a scalar, in the second it is not. Everything else is the same, except the resulting behavior. Is this permitted by the LRM? I know that compilers can pass non-scalar parameters by copy-in/copy-out or reference, but should that effect exception handling? Is Ada/9x addressing this? Thanks. Stuart. (weinstei@kong.gsfc.nasa.gov) with text_io; procedure t1 is type intarr is array(1..50) of integer; zero : integer; a : integer; arr : intarr; procedure sub1(x : in out integer) is y : integer := 1; begin x := x + 10; y := y / zero; -- raise exception end sub1; procedure sub2(x : in out intarr; i : in integer) is y : integer := 1; begin x(i) := x(i) + 10; y := y / zero; -- raise exception end sub2; begin zero := 0; a := 5; text_io.put_line("Before sub1: A = " & integer'image(a)); begin sub1(a); exception when others => null; end; text_io.put_line("After sub1: A = " & integer'image(a)); arr(12) := 5; text_io.put_line("Before sub1: ARR(12) = " & integer'image(arr(12))); begin sub2(arr,12); exception when others => null; end; text_io.put_line("After sub1: ARR(12) = " & integer'image(arr(12))); end; Output from DEC Ada 2.2: Before sub1: A = 5 After sub1: A = 5 Before sub1: ARR(12) = 5 After sub1: ARR(12) = 15