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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99c75a8440c619dc X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Array range type for Verdix Ada83 compiler question. Date: 1999/09/09 Message-ID: <37D83563.51EE808A@averstar.com>#1/1 X-Deja-AN: 523147581 Content-Transfer-Encoding: 7bit Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.burl.averstar.com References: <37D8106C.3F17@pipeline.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-09-09T00:00:00+00:00 List-Id: Michael wrote: > > Hi, > > I have a bit a code: > > type ta is array (0 .. 8) of boolean; > type Request_Numbers_Array is array (-100 .. 100) of integer; > > The first line compiles just fine. > The second line says: "index range is ambiguous" and then gives me a > list of possible types (i.e. Short, Long, Integer . . .) > > I fixed the problem in this way: > type Request_Numbers_Array is array (Integer range -100 .. 100) of > integer; > > My question is: Why do I need to do this? As pointed out by another respondant, there is ambiguity in the choice of the "-" operator. This problem does not arise in Ada 95 because of a special rule that makes these "anonymous" integral ranges end up being treated as Standard.Integer. This rule was added specifically because of the surprise programmers had when they wrote what you wrote, or similarly, for I in -100 .. 100 loop which also is ambiguous in Ada 83, but treated like for I in Integer(-100) .. Integer(100) loop in Ada 95 > > I would think it could pick a type most suitable for the range. That could be trouble, because you would not have a name for the type that was chosen. I suppose you could use Request_Numbers_Array'Range, but generally implicit definitions of types inside other type definitions are not allowed in Ada. > Thanks in advance, > > Michael -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Distributed IT Solutions (www.averstar.com/tools) AverStar (formerly Intermetrics, Inc.) Burlington, MA USA