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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!mnetor!uunet!husc6!hao!ames!pasteur!ucbvax!software.ORG!harrison From: harrison@software.ORG (Tim Harrison) Newsgroups: comp.lang.ada Subject: Usage of OTHERS choice Message-ID: <8803091724.AA02141@ajpo.sei.cmu.edu> Date: 8 Mar 88 22:40:33 GMT Sender: uucp@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: I have submitted the following code to two validated compilers. The designated line is rejected as illegal by one of the compilers. Is the OTHERS choice actually illegal? ---------------------------------------------------------------------- package BOOLEAN_DATA is type BOOLEAN_ARRAY is array (NATURAL range <>) of BOOLEAN; procedure INITIALIZE(OBJECT : in out BOOLEAN_ARRAY); end BOOLEAN_DATA; package body BOOLEAN_DATA is procedure INITIALIZE(OBJECT : in out BOOLEAN_ARRAY) is begin OBJECT := (others => FALSE); -- rejected by one compiler end INITIALIZE; end BOOLEAN_DATA; ---------------------------------------------------------------------- The compiler that rejects the code gives "RM 4.3.2(5): OTHERS illegal for unconstrained array" as the reason for rejection. Here is what I believe to be the basis for the decision to reject the OTHERS choice in this example. RM 4.3.2(4-5) states: ...An *others* choice is only allowed if the aggregate appears in one (4) of the following contexts (which defined the applicable index constraint): (a) The aggregate is ... the expression that follows an assignment (5) compound delimiter. Moreover, the subtype of the corresponding ... object is a constrained array subtype. What is the subtype of the object OBJECT? Can someone provide me with a citation that specifies the subtype of OBJECT? I think that the following citations are relevant, but they don't state the case clearly enough for me to believe that they are providing me with a definition for the subtype of OBJECT. RM 6.2(9): "...For a formal parameter of an unconstrained array type, the bounds are obtained from the actual parameter, and the formal parameter is constrained by these bounds (see 3.6.1)..." RM 3.6.1(9): "For a formal parameter of a subprogram or entry, the bounds are obtained from the corresponding actual parameter. (The formal parameter is constrained with the corresponding values of the bounds)." RM 6.2(9): "...the formal parameter is unconstrained if and only if the mode is IN OUT or OUT and the variable name given in the actual parameter denotes an unconstrained variable" The above citations indicate that the formal parameter does have bounds and that it is constrained, but doesn't say that the effect is a constrained subtype. So, what is the subtype of OBJECT? Is it constrained or not? -- Tim H.