comp.lang.ada
 help / color / mirror / Atom feed
From: kst@thomsoft.com (Keith Thompson)
Subject: Re: Newbie question (Range Specifiers)
Date: 1996/06/21
Date: 1996-06-21T00:00:00+00:00	[thread overview]
Message-ID: <DtCDsA.KCC@thomsoft.com> (raw)
In-Reply-To: 4qbvma$ajd@michp1.redstone.army.mil


In <4qbvma$ajd@michp1.redstone.army.mil> "Kevin J. Weise" <kweise@c3i-ccmail.sed.redstone.army.mil> writes:
> "Sandeep V. Kharkar" <skharkar@vzcorp.com> wrote:
[...]
> >	In the book I found a grammer rule for range specifiers
> >	which goes
> >
> >	range_spec ::= name ' range ( static_expression )
> >
> >	but I found no examples of the use of this grammer rule.
> >	
> >	What is this syntax used for ??
[...]
> I've been in this business long enough that the region in my brain
> previously occupied by the Ada83 LRM has been recovered and filled with
> application-specific trivia; there isn't enough room left to memorize
> the Ada95 LRM.  But in a brief scan of the Ada95 RM (principally in
> Annex P, the Syntax Summary and the Syntax Cross Reference), I couldn't
> find the nonterminals or the production you specified above.  Can you
> please come back with a specific reference (i.e., document, section,
> page number, whatever) where you found this beastie?  I'd love to dig
> into it & find the answer myself.

It's in section 4.1.4 of Annex P:

    4.1.4:
    range_attribute_reference ::= prefix'range_attribute_designator
 
    4.1.4:
    range_attribute_designator ::= Range[(static_expression)]

The static_expression, if present, specifies which dimension of an array
the range attribute refers to.  For example, given the declarations
 
    type Matrix is array(Positive range <>, Positive range <>) of Float;
    M: Matrix(1 .. 10, 1 .. 20);

M'Range(1) is 1 .. 10, and M'Range(2) is 1 .. 20.  The same applies to
the 'First, 'Last, and 'Length attributes.

See also the definition of the 'Range attribute in Annex K.

This was defined slightly differently in Ada 83, but with essentially
the same effect.

-- 
Keith Thompson (The_Other_Keith) kst@thomsoft.com <*>
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
"As the most participatory form of mass speech yet developed, the Internet
deserves the highest protection from government intrusion." -- ACLU v. Reno




      reply	other threads:[~1996-06-21  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-19  0:00 Newbie question (Range Specifiers) Sandeep V. Kharkar
1996-06-20  0:00 ` Sandeep V. Kharkar
1996-06-20  0:00 ` Kevin J. Weise
1996-06-21  0:00   ` Keith Thompson [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