From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,502eafcf316bcb10 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-13 12:41:53 PST Path: bga.com!news.sprintlink.net!pipex!uunet!zib-berlin.de!news.th-darmstadt.de!terra.wiwi.uni-frankfurt.de!zeus.rbi.informatik.uni-frankfurt.de!news.dfn.de!uni-muenster.de!asterix.uni-muenster.de!rentmei From: rentmei@asterix.uni-muenster.de (Jahn Rentmeister) Newsgroups: comp.lang.ada Subject: Re: Ada can't initialize (aggregate) array of length 1? Date: 13 Dec 1994 17:01:20 GMT Organization: Westfaelische Wilhelms-Universitaet Muenster, Germany Message-ID: <3ckk10$1r0a@majestix.uni-muenster.de> References: <1994Dec12.081230.24978@roxi.rz.fht-mannheim.de> <3chh6i$lp7@cnj.digex.net> NNTP-Posting-Host: asterix.uni-muenster.de X-Newsreader: TIN [version 1.2 PL2] Date: 1994-12-13T17:01:20+00:00 List-Id: Gentle (gentle@cnj.digex.net) wrote: : On Mon, 12 Dec 94 08:12:30 CET, Dirk Zoller (duz@roxi.rz.fht-mannheim.de) wrote: : : Simplified I did this: : : type stone is array (1..2) of character; : : shapes: constant array (1..1) of stone := ("[]"); : : ____________________________________________^ : You're trying to squash a string of length 2 into a character space. : Try initializing like this: : shapes: constant array (1..1) of stone := (1 => ('[',']')); : Although type stone could have been declared as a subtype of STRING of : length 2, then your initialization would have worked. I don't think so. (Let's be careful, I did not check it in a reference, either. But nevertheless, I'm just as sure as you were. :-) The ""-literals are available for _all_ arrays of characters, not only for the predefined type string. The ('[',']') aggregate is equivalent (as far as it matters here) to the "[]" literal. The reason why your code worked and the code of Dirk Zoller didn't was the "1 =>". For an Ada compiler ("[]") does not look like an array aggregate: It's a single string. Therefore one has to use named notation like in (1=>"[]") or (others=>"[]"). The latter works only if the range "others" stands for is known to the compiler. (in this case, it is). Declaring stone to be a subtype of STRING would probably be helpful when doing output, though. : Too much of a good thing is WONDERFUL. : -- Mae West Me, too. -Jahn