Ada Question

jimmie.davis@l-3com.com jimmie.davis@l-3com.com
Mon Sep 26 22:11:00 GMT 2011


given this example:

with text_io;
use text_io;

procedure a is
procedure foo ( X:Integer; Y:OUT Integer) is begin
  if (X>24) then
    Y:=16;
  end if;
end;

a:integer:=0;
b:integer;

begin
   foo(a,b);
   text_io.put_line(integer'image(b));
end;


gnat 4.6 prints out a randome value. (well in my case I get 1, but it is
meaningless)

shouldn't I get a run time exception.  Calling a procedure with an OUT
parameter and never giving it a value.
i am not an ada lawyer, but I would think an exception would be in order
here.


--bud davis

 



More information about the Gcc-help mailing list