comp.lang.ada
 help / color / mirror / Atom feed
From: chuck@brain.UUCP (Chuck Shotton)
Subject: LRM Oddity
Date: 28 Jun 91 23:13:00 GMT	[thread overview]
Message-ID: <D2150025.jclfmd@brain.UUCP> (raw)

I ran into this oddity today. Can someone please explain the rationale behind
it?

type record_type is record
   a, b: integer;
end record;

a_var         : array (1..3) of record_type := ((1,2), (3,4), (5,6)); -- syntax OK
another_var   : array (1..1) of record_type := ((1,2)); -- compiler error
one_more_var  : array (1..1) of record_type := (1 => (1,2)); -- syntax OK

Apparently, Ada requires that initialized arrays with only ONE element must
use positional specifications for the initialization data. But, if there is
more than one element, the positional specification (ex. 1 => ) is not required.

WHY? (I can only assume that it makes it clear that the "(1,2)" initializes to
a single array element and not two. Seems sort of odd....

-----------------------------------------------------------------------
Chuck Shotton                 Internet:  cshotton@girch1.med.uth.tmc.edu
BIAP Systems                  UUCP:      ...!buster!brain!chuck
"Your silly quote here."      AppleLink: D1683       MacNet: shotton

                 reply	other threads:[~1991-06-28 23:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox