From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dfadb64ce9f4daa5,start X-Google-Attributes: gid103376,public From: rlove@neosoft.com (Robert B. Love ) Subject: Which compiler is correct?? Date: 1996/09/10 Message-ID: <514uuu$d8i@uuneo.neosoft.com>#1/1 X-Deja-AN: 179819801 organization: NeoSoft, Inc. newsgroups: comp.lang.ada Date: 1996-09-10T00:00:00+00:00 List-Id: I've got a situation where I put the same piece of code thru two compilers on the same hardware and one will compile it, the other gives errors. The code is listed below and is taken from Richard Riehle's article in JOOP on "Managing Runtime Faults". GNAT compiles it fine. Aacademic ObjectAda fails to compile it. I can see maybe 4 choices: 1) GNAT is wrong, 2) ObjectAda is wrong, 3) the code is wrong, 4) I need to set some compile switches on one compiler or the other. On a PC with GNAT 304a touted as being compiled for Windows and GNAT 301 on a NeXT/M68040 I get no errors. With Academic ObjectAda v7.0.171 I get 3 occurrences of the same error along with line and column numbers. LRM:6.4.15(5) If the mode is IN OUT or OUT, the actual shall be a name that denotes a variable. I need a language lawyer to tell me what is actually wrong. Note I made 2 change to Riehle's article, commented with "my change" with ada.exceptions; use ada.exceptions; with text_io,ada.integer_text_io;use text_io; procedure exception_demo is error_list: array(1..3) of exception_occurrence; d1,d2,d3: integer; function square(data:integer) return integer is begin return data*data; exception when error_in_square_function: constraint_error => ada.exceptions.save_occurrence (error_in_square_function,error_list(1)); return 0; end square; function compute(v1,v2:integer) return integer is begin return square(v1) + square(v2); exception when error_in_compute: constraint_error=>ada.exceptions.save_occurrence (error_in_compute,error_list(2)); return 0; -- my change end compute; begin Ada.Integer_Text_Io.Get(Item=>D1); Ada.Integer_Text_Io.Get(Item=>D2); D3 := Compute(V1=>D1,V2=>D2); -- my chanage exception when Error_In_Demo: others => Ada.Exceptions.Save_Occurrence (Error_In_Demo,Error_List(3)); for I in Error_List'Range loop Text_Io.Put_Line(Exception_Message(Error_List(I))); Text_Io.Put_Line(Exception_Name(Error_List(I))); Text_Io.Put_Line(Exception_Information(Error_List(I))); end loop; end exception_demo; ---------------------------------------------------------------- Bob Love, rlove@neosoft.com (local) MIME & NeXT Mail OK rlove@raptor.rmnug.org (permanent) PGP key available ----------------------------------------------------------------