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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8623fab5750cd6aa X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 17 Jun 2004 10:50:26 -0500 Date: Thu, 17 Jun 2004 11:50:26 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Improving Ada's image - Was: 7E7 Flight Controls Electronics References: <40b9c99e$0$268$edfadb0f@dread16.news.tele.dk> <7J0xc.7371$8k4.269106@news20.bellglobal.com> <1086630278.542788@master.nyc.kbcfp.com> <8xlxc.27603$sS2.845496@news20.bellglobal.com> <1086715817.122983@master.nyc.kbcfp.com> <1086733411.736049@master.nyc.kbcfp.com> <3Auxc.11998$XY6.1296622@read2.cgocable.net> <40C85035.4020706@noplace.com> <40C9EC3B.60304@noplace.com> <40CD90A4.8030005@noplace.com> <40CEDCB5.9000509@noplace.com> <1087325485.307616@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-qXCFa/Txmg7YoeoX4I70VLOo+VT42w3FEdVj5xc7DNUZok1CtcjO92U1Exu/U6w/lN7obsoG2QgbBEI!dxSfGkg9ss3PJEym2zH66/aqB95xnVuFB0EfH947u3TXSIwSGUaqIUqfSouHPg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:1626 Date: 2004-06-17T11:50:26-04:00 List-Id: Hyman Rosen wrote: > No, it's a complete hash. Isn't it wrong as well? It claims that 0 > can't be used as a lower bound for String. Why ask here? You can write a couple of lines in Ada, and look at the error message you get. Now, putting on my language lawyer hat Hyman is "correct" but for normal use the tutorial is fine. You can define a null String in Ada as: Foo: String(0..-1); and while declaring: Bar: String(0..1) := " "; is legal most compilers will provide a warning that Constraint_Error will be raised at run time. With GNAT 3.15p, the program: procedure String_Test is Foo: String(0..-1); Bar: String(0..1) := " "; begin null; end; Compiles, but with the warning: string_test.adb:3:15: warning: static value out of range of type "Standard.Positive" string_test.adb:3:15: warning: "Constraint_Error" will be raised at run time > This "tutorial" is exactly > what I was talking about - something which will utterly confuse C > programmers, because it does nothing to address them on terms they > understand, having come from an environment where strings are > variable-sized sequences within fixed-length buffers, with a null > character as an end marker. So it tells them to use Ada.Strings.Unbounded: "To overcome the constraint problem for strings Ada has a predefined package Ada.Strings.Unbounded which implements a variable length string type." Again, as a language lawyer, I would suggest both Bounded and Unbounded and explain the differences, but that is not the object of this tutorial. -- Robert I. Eachus The ideology he opposed throughout his political life insisted that history was moved by impersonal tides and unalterable fates. Ronald Reagan believed instead in the courage and triumph of free men and we believe it all the more because we saw that courage in him. -- George W. Bush June 11, 2004