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,7ba49aac4e73460 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.226.10 with SMTP id ro10mr4469535pbc.6.1328904206685; Fri, 10 Feb 2012 12:03:26 -0800 (PST) Path: wr5ni9725pbc.0!nntp.google.com!news2.google.com!news.glorb.com!solaris.cc.vt.edu!news.vt.edu!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Need Help On Ada95 Problem Date: Fri, 10 Feb 2012 15:03:26 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <553ceec3-ec34-41de-9723-0dc342379cfe@vv9g2000pbc.googlegroups.com> <4ea6309f-cf07-44f6-8c56-5189a0081dcc@g27g2000yqa.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1328904206 30106 192.74.137.71 (10 Feb 2012 20:03:26 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 10 Feb 2012 20:03:26 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:bjAHtvjqaz/fw20fErD/+F31ZYM= Content-Type: text/plain; charset=us-ascii Date: 2012-02-10T15:03:26-05:00 List-Id: "Alex" writes: > I'm curious about your code sample: > > X : String(0 .. -1000); > > I tried it and it works, but I don't understand how it's possible. > String is defined in ARM 3.6.3 as > > type String is array(Positive range <>) of Character; > > and your range is definitely outside of Positive. If I try > > X : String(0 .. 500); > > I get the expected compiler error. Constraint_Error at run-time, I assume. And maybe a compile-time warning (which you wouldn't get if 500 were known only at run time). >...What's going on that allows the > range to be from 0 to a negative number? There is a check that the bounds belong to the index subtype, but that only applies if it's not a null range. For String, you certainly want to allow 1..0 for an empty string. Allowing 0..0 or 0..-1000 for String is a language design flaw, which has been discussed here many times. For that matter, allowing 5..10 is a flaw. This causes needless inefficiency and obscure bugs. - Bob