From: "Marc A. Criley" <marc.a.criley@lmco.com>
Subject: Re: Positional Aggregates
Date: 1998/11/11
Date: 1998-11-11T00:00:00+00:00 [thread overview]
Message-ID: <3649C2F4.B774158E@lmco.com> (raw)
In-Reply-To: 72cbru$juh@gcsin3.geccs.gecm.com
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
prev parent reply other threads:[~1998-11-11 0:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-11 0:00 Positional Aggregates John McCabe
1998-11-11 0:00 ` dennison
1998-11-12 0:00 ` dewar
1998-11-12 0:00 ` John McCabe
1998-11-12 0:00 ` dewarr
1998-11-11 0:00 ` John McCabe
1998-11-12 0:00 ` dewarr
1998-11-12 0:00 ` John McCabe
1998-11-11 0:00 ` Marc A. Criley [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox