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.1 required=5.0 tests=BAYES_05,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,36b12252024e3bc0 X-Google-Attributes: gid103376,public From: "Marc A. Criley" Subject: Re: Positional Aggregates Date: 1998/11/11 Message-ID: <3649C2F4.B774158E@lmco.com>#1/1 X-Deja-AN: 410767388 Content-Transfer-Encoding: 7bit References: <72cbru$juh@gcsin3.geccs.gecm.com> Content-Type: text/plain; charset=us-ascii Organization: Lockheed Martin M&DS Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-11-11T00:00:00+00:00 List-Id: John McCabe wrote: > > In a declarative part of a subroutine I have lines like the following: > > Files_Used : constant := 1; > Files_Index : array (1..Files_Used) of Integer := (17); > > When compiled, I get a warning: > > error: positional aggregate cannot have one component Actually, that's an error :-) > > Is this valid for an array with only one element? No, the reason is the syntactic ambiguity of a single expression within parentheses. The parser can't distinguish between "(17) the single- element aggregate" and "(17) the number with unnecessary parameters". The solution to this, in those situations where you're hardcoding the single element aggregate initializations, is of course: Files_Index : array (1..Files_Used) of Integer := (1 => 17); > -- > Best Regards > John McCabe > --------------------------------------------------------------------- > Marconi Electronic Systems > Simulation & Training Division > ===================================================================== > Not necessarily my company or service providers opinions. > ===================================================================== -- Marc A. Criley Chief Software Architect Lockheed Martin ATWCS marc.a.criley@lmco.com Phone: (610) 354-7861 Fax : (610) 354-7308