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,505b52f527b29fd6 X-Google-Attributes: gid103376,public From: Peter Amey Subject: Re: Are there any "bad" Ada constructs? Date: 1996/09/05 Message-ID: #1/1 X-Deja-AN: 178621017 references: <322E16DC.74B1@swcp.com> content-type: TEXT/PLAIN; charset=US-ASCII organization: Praxis plc, U.K. mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-09-05T00:00:00+00:00 List-Id: > > My question is: Are there any constructs in Ada that are permitted to do > two or more different things and still be correct, in a manner that > is similar to that listed above? > There are, mostly associated with aliasing, evaluation order and elaboration order. A simple example is: procedure Init2(X, Y : out integer) is begin X := 1; Y := 2; end Init2; The call Init2(A, A); can set A to 1 or 2 because the order of parameter association is undefined (I have two validated compilers which actually demonstrate this effect). Ada has a bit of a cop out in that it labels programs whose meaning varies in this way "erroneous"; however, applying such a label doesn't make the problems any easier to detect or prevent. Some secure Ada subsets such as SPARK are completely free of this form of anomalous behaviour. Peter