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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,dfc164e526616c68 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!newsfeed.inode.at!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: How to extract range from array Date: Mon, 20 Mar 2006 20:01:03 +0100 Organization: Cablecom Newsserver Message-ID: <2901131.Fq1M6N3cKt@linux1.krischik.com> References: <1142608344.661977.123860@i39g2000cwa.googlegroups.com> NNTP-Posting-Host: 84-74-134-212.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1142884806 21865 84.74.134.212 (20 Mar 2006 20:00:06 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Mon, 20 Mar 2006 20:00:06 +0000 (UTC) User-Agent: KNode/0.10.1 Xref: g2news1.google.com comp.lang.ada:3497 Date: 2006-03-20T20:01:03+01:00 List-Id: Maciej Sobczak wrote: > Martin Krischik wrote: > >> Read: >> >> http://en.wikibooks.org/wiki/Ada_Programming/Types/array#Array_Attributes > > subtype My_Range is Integer range My_Array'Range; > > This suggests that arrays cannot have more elements than Integer'Last. > Which cannot be true. You should have copied the original example: Hello_World : const String := "Hello World!"; subtype Hello_World_Index is Integer range Hello_World'Range; > What am I missing? You are missing the definition of String which is part of Standard: http://en.wikibooks.org/wiki/Ada_Programming/Libraries/Standard and reads something like this (on GNAT): type Integer is range -(2 ** 31) .. +(2 ** 31 - 1); subtype Positive is Integer range 1 .. +(2 ** 31 - 1); type String is array (Positive range <>) of Character; pragma Pack (String); And indeed the array in the example can not be larger then Integer'Last because Strings are not larger then Integer'Last. Of corse you could define: type Long_Long_Integer is range -(2 ** 63) .. +(2 ** 63 - 1); subtype Long_Long_Positive is Integer range 1 .. +(2 ** 63 - 1); type Long_Long_String is array (Long_Long_Positive range <>) of Character; pragma Pack (Long_Long_String); And then order additional memory for your computer to store Long_Long_String's in ;-) Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com