From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: surprise data from Ada.Sequential_IO
Date: Mon, 22 Mar 2021 22:54:22 +0200 [thread overview]
Message-ID: <ibsefvF6rd3U1@mid.individual.net> (raw)
In-Reply-To: <s3aru5$7tg$1@dont-email.me>
On 2021-03-22 21:41, Jeffrey R. Carter wrote:
> The only differences between Direct_IO and Sequential_IO are that
> Direct_IO allows random access and mixed input and output. In both cases
> the file contains a sequence of binary representations of values of a
> single type.
>
> I don't really understand why Sequential_IO exists, since Direct_IO
> provides a superset of Sequential_IO's functionality.
Not quite. From the RM:
generic
type Element_Type is private;
package Ada.Direct_IO is
...
and
generic
type Element_Type(<>) is private;
package Ada.Sequential_IO is
...
So Sequential_IO allows unknown discriminants in the element type, in
other words elements that can vary in size, which obviously hampers
random (indexed) access to elements in the file, which Direct_IO allows.
There is also this note for Direct_IO:
RM A.8.4(19.a): Reason: The Element_Type formal of Direct_IO does not
have an unknown_discriminant_part (unlike Sequential_IO) so that the
implementation can make use of the ability to declare uninitialized
variables of the type.
next prev parent reply other threads:[~2021-03-22 20:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 17:13 surprise data from Ada.Sequential_IO John Perry
2021-03-22 17:40 ` Jeffrey R. Carter
2021-03-22 18:14 ` John Perry
2021-03-22 19:41 ` Jeffrey R. Carter
2021-03-22 20:54 ` Niklas Holsti [this message]
2021-03-23 9:18 ` Jeffrey R. Carter
2021-03-22 21:25 ` Shark8
2021-03-22 17:48 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox