From: Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
Subject: Re: GNAT's Text_IO & empty files
Date: 1998/07/07
Date: 1998-07-07T00:00:00+00:00 [thread overview]
Message-ID: <35A21B66.1509490B@cl.cam.ac.uk> (raw)
In-Reply-To: dewar.899765885@merv
Robert Dewar wrote:
> -- For files other than standard error and standard output, we
> -- make sure that an empty file has a single line feed, so that
> -- it is properly formatted. We avoid this for the standard files
> -- because it is too much of a nuisance to have these odd line
> -- feeds when nothing has been written to the file.
>
> elsif (File /= Standard_Err and then File /= Standard_Out)
> and then (File.Line = 1 and then File.Page = 1)
> then
> New_Line (File);
> end if;
>
>
> Most certainly if you comment these lines out, your resulting runtime will
> not be compliant with annex A of the reference manual. These lines were not
> put in for amusement!
Having just read RM A.10 �7, I think the Ada standard is badly
formulated here. It is not clear how a file or a page with zero
lines or a file with zero pages has to be encoded. The standard writes
that a file is a sequence of pages and a page is a sequence of lines,
but it does not handle the obvious border case of zero-length
sequences adequatly. It would have been better to write just that
every line terminates with a line terminator, and every page
terminates with a page terminator, and then everything would have
been clear and consistent. With a bit good will, the Ada RM language
can even be interpreted that way.
Back to my Unix convention remark: Although vi cannot produce a
file in which the last line does not end with LF, it can very
well produce a file that contains zero lines and is therefore
zero bytes long.
Markus
--
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org, home page: <http://www.cl.cam.ac.uk/~mgk25/>
next prev parent reply other threads:[~1998-07-07 0:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-07-06 0:00 GNAT's Text_IO & empty files Gautier de Montmollin
1998-07-06 0:00 ` Pascal MALAISE
1998-07-07 0:00 ` Gautier
1998-07-07 0:00 ` Kevin Radke
1998-07-06 0:00 ` Robert Dewar
1998-07-07 0:00 ` Gautier
1998-07-07 0:00 ` Robert I. Eachus
1998-07-07 0:00 ` Robert Dewar
1998-07-07 0:00 ` Markus Kuhn
1998-07-07 0:00 ` Samuel Tardieu
1998-07-08 0:00 ` Aaro Koskinen
1998-07-09 0:00 ` Gautier.DeMontmollin
1998-07-09 0:00 ` Samuel Tardieu
1998-07-07 0:00 ` Gautier
1998-07-08 0:00 ` dennison
1998-07-07 0:00 ` Markus Kuhn [this message]
1998-07-07 0:00 ` Robert Dewar
1998-07-07 0:00 ` Michael F Brenner
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox