comp.lang.ada
 help / color / mirror / Atom feed
* End_Of_File underspecified?
@ 2006-11-21 14:49 Maciej Sobczak
  2006-11-21 17:40 ` Adam Beneschan
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej Sobczak @ 2006-11-21 14:49 UTC (permalink / raw)


Hi,

I cannot find any specification of whether End_Of_File can be a blocking 
operation.
Unfortunately, my experience from other languages breaks into pieces 
here, because Ada uses EOF a bit differently (in other languages the EOF 
flag is set *after* hitting the end of file and as a result of it, so 
that querying the flag is just this - querying the flag).

I would expect that End_Of_File is a non-blocking predicate that allows 
the programmer to take the decision on what to do next with the file. 
Curiously, it does not seem to be the case - End_Of_File can block, 
which is easy to demonstrate on a regular Unix-like (GNAT) system.

Nothing in ARM mentions this.

-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: End_Of_File underspecified?
  2006-11-21 14:49 End_Of_File underspecified? Maciej Sobczak
@ 2006-11-21 17:40 ` Adam Beneschan
  0 siblings, 0 replies; 2+ messages in thread
From: Adam Beneschan @ 2006-11-21 17:40 UTC (permalink / raw)


Maciej Sobczak wrote:
> Hi,
>
> I cannot find any specification of whether End_Of_File can be a blocking
> operation.
> Unfortunately, my experience from other languages breaks into pieces
> here, because Ada uses EOF a bit differently (in other languages the EOF
> flag is set *after* hitting the end of file and as a result of it, so
> that querying the flag is just this - querying the flag).
>
> I would expect that End_Of_File is a non-blocking predicate that allows
> the programmer to take the decision on what to do next with the file.
> Curiously, it does not seem to be the case - End_Of_File can block,
> which is easy to demonstrate on a regular Unix-like (GNAT) system.
>
> Nothing in ARM mentions this.

I assume you're talking about a "potentially blocking" operation?
9.5.1(18) says, "In particular, the subprograms of the language-defined
input-output packages that manipulate files (implicitly or explicitly)
are potentially blocking."  AI95-178 and AARM05 9.5.1(18.a/2) says that
any subprogram in a language-defined I/O package (or instance thereof)
that has a file parameter or result, or operates on a default file, is
considered to manipulate a file.  This includes pretty much everything,
including End_Of_File.  I suppose you're right that the explanation of
"manipulation" isn't, technically, in the ARM---maybe a Note should be
added, although it may be too late.

                              -- Adam




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-21 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-21 14:49 End_Of_File underspecified? Maciej Sobczak
2006-11-21 17:40 ` Adam Beneschan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox