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,a0833bbed8752e1f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 28 Oct 2004 17:48:50 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1861614.TWv5A9FgVL@linux1.krischik.com> <4178e979_1@baen1673807.greenlnk.net> <1195374.UMjBCk7lO1@linux1.krischik.com> <1154613.ipZcUgduzp@linux1.krischik.com> Subject: Re: variable lenght strings Date: Thu, 28 Oct 2004 17:50:19 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-W7yOrLItYoDjF+0QeWMZEsfHBqBtjzz1e+NtjreNhJ5BFLQ2EBmbG0IitIeZce8nFBl1dcqd565NSVC!P/v0i41pbKXypG7JC9KtpDZMJ+70w9+8D+X8rgyUGEyitaKm9Q4xlpEaIOOTSCF8mQQ+jNMkfrAR X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.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.3.20 Xref: g2news1.google.com comp.lang.ada:5810 Date: 2004-10-28T17:50:19-05:00 List-Id: "Jeffrey Carter" wrote in message news:a4wfd.3107$kM.1044@newsread3.news.pas.earthlink.net... > Randy Brukardt wrote: > > > My opinion is that GNAT is wrong in that case. A.10(7) makes it quite > > clear that you can't have a file terminator without a line and page > > terminator in front of it. > > Shouldn't that be "... without an implied line ..."? Clearly text files > from external sources can lack the explicit terminators, or we wouldn't > be having this discussion. > > FWIW, ObjectAda 7.2.2 SE gives the same behavior. Get_Line successfully > reads a non-null line shorter than the string at the end of the file > without the line-terminator characters, but fails on a null line at the > same place. I can see the logic of that: If you've just skipped the line > terminator of the last line, you have the same situation, and an attempt > to read should raise End_Error. Huh? A null line without a line terminator would be indistinguishable from a line terminator at the end of a file. So it is perfectly reasonable for an implementation to treat this as reading past the end of a file (Janus/Ada certainly does too). Indeed, I'd argue that it is impossible for there to be a null line without a line terminator at the end of a file. The case I'm talking about is when the last line is *not* null and there is no explicit line terminator. In that case, the implementation should provide an implicit line terminator, as the logical view of a file is that it is always there (see A.10(7)), and (IMHO) it is unreasonable to refuse to properly process a file that is missing one. But I don't think that there is anything that the ARG can say here, because what is actually in a file is not defined by the language, and an implementor can simply say that the file is misformatted. That may be bad for users, but it certainly fits within the language. Note that implementations have to have implicit page terminators at the end of the file (putting in explicit ones would be awful, and there are ACATS tests which check that the one at the end of the file actually exists), so supporting implicit line terminators isn't that much extra work. Randy.