comp.lang.ada
 help / color / mirror / Atom feed
* LRM Oddity
@ 1991-06-28 23:13 Chuck Shotton
  0 siblings, 0 replies; only message in thread
From: Chuck Shotton @ 1991-06-28 23:13 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1991-06-28 23:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-06-28 23:13 LRM Oddity Chuck Shotton

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