comp.lang.ada
 help / color / mirror / Atom feed
* Ada can't initialize (aggregate) array of length 1?
@ 1994-12-12  7:12 Dirk Zoller
  1994-12-12 12:54 ` Gentle
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Dirk Zoller @ 1994-12-12  7:12 UTC (permalink / raw)


Hello,

yesterday I ran accross the following problem. Trying to write a little
tetris game as an excercise in Ada programming I wanted to initialize
an array of arrays of char i.e. the different shapes of stones.  Not
being sure about the aggregate syntax I experimented with an array of
length 1 as a start.

This didn't work, not for the wrong aggregate syntax (which is similar
enough to C) but because of the array length 1.

Simplified I did this:

    type stone is array (1..2) of character;
    shapes: constant array (1..1) of stone := ("[]");
    ____________________________________________^

At this point I got an error message about type stone expected.
When using two stones, it works:

    shapes: constant array (1..2) of stone := ("[]", "{}");

I further simplified it to this:

    type t1 is array (1..1) of integer;
    v1: constant t1 := (1234);

didn't work with the message aggregates of length 1 were not allowed.
Why? My books don't seem to know about (mention) this peculiarity.
I use gnat 2.0 on OS/2.

Dirk
---
duz@roxi.rz.fht-mannheim.de <Dirk Zoller>
The world is switching from the 'computers are magical, programmers are
magicians' to 'computer=TV+typewriter+fax+telephone' --- Will Baguhn



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1994-12-19 14:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-12-12  7:12 Ada can't initialize (aggregate) array of length 1? Dirk Zoller
1994-12-12 12:54 ` Gentle
1994-12-12 18:35   ` Bob Duff
1994-12-13 17:01   ` Jahn Rentmeister
1994-12-14  3:23   ` Robert Dewar
1994-12-12 13:20 ` R. William Beckwith
1994-12-16 13:34   ` gamache
1994-12-14  3:21 ` Robert Dewar
1994-12-16 10:37   ` Dirk Zoller
1994-12-19 14:20     ` Robert Dewar
1994-12-16 16:41   ` Scott Leschke
1994-12-17 17:52     ` Robert Dewar

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