2) The output value depends of the size of IntArray!
>> with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Text is type IntArray is array (1 .. 500) of Integer;
type MyStruct is record
Value : Integer;
A : IntArray := (others => 0);
end record;
function Compute (Value1 : MyStruct; Value2 : in out MyStruct) return Integer is
begin
Put_Line ("1 value1=" & Integer'Image(Value1.Value) & " value2=" & Integer'Image(Value2.Value));
Value2.Value := Value2.Value - 1;
Put_Line ("2 value1=" & Integer'Image(Value1.Value) & " value2=" & Integer'Image(Value2.Value));
return Value1.Value * 2;
end Compute;
Value1 : MyStruct := (Value => 10, A => (others => 0));
Value2 : MyStruct := (Value => 20, A => (others => 0));
Result1 : Integer;
Result2 : Integer;
begin
Result1 := Compute(Value1, Value2);
Put_Line ("a value1=" & Integer'Image(Value1.Value) & " value2=" & Integer'Image(Value2.Value) & " result1=" & Integer'Image(Result1));
Result2 := Compute(Value1, Value1);
Put_Line ("b value1=" & Integer'Image(Value1.Value) & " value2=" & Integer'Image(Value2.Value) & " result2=" & Integer'Image(Result2));
end Text;
<<