From: duz@roxi.rz.fht-mannheim.de (Dirk Zoller)
Subject: Ada can't initialize (aggregate) array of length 1?
Date: Mon, 12 Dec 94 08:12:30 CET
Date: 1994-12-12T08:12:30+01:00 [thread overview]
Message-ID: <1994Dec12.081230.24978@roxi.rz.fht-mannheim.de> (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
next reply other threads:[~1994-12-12 7:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-12-12 7:12 Dirk Zoller [this message]
1994-12-12 12:54 ` Ada can't initialize (aggregate) array of length 1? 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox