Re: Direct_IO and files of tagged types
- From: "Randy Brukardt" <randy@xxxxxxxxxxxxxx>
- Date: Thu, 26 May 2005 18:51:47 -0500
"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> wrote in message
news:86bcmsy3e49m.yjhfcxtf7osr.dlg@xxxxxxxxxxxxx
> On 26 May 2005 10:20:09 -0700, John McCormick wrote:
>
> > When I instantiate a version of Ada.Direct_IO with an element type that
> > is statically tagged (it is of a specific tagged type) GNAT gives me a
> > warning that the element type contains an access value. My tagged type
> > has three integer fields - no access types. I assume that the access
> > type referenced in the warning is to the tag mechanism. Any suggestions
> > for ways to create binary files of statically tagged objects?
>
> It is not a good idea to write tags into a file even if they are
statically
> known, because that cannot be portable. Another general question is: if
the
> tag is always known what for to have it? Without dispatching tags are just
> useless overhead!
If the object is derived from Controlled, it will be tagged even if no
(explicit) dispatching is used. And I think that virtually all ADT types
should be controlled and extensible -- so virtually all types will have
tags. At worst the overhead is "useless" now; but that probably will change
in the future.
My suggestion to John would be to abandon Direct_IO and use Streams instead;
'Write doesn't write the tag, and Stream_IO allows positioning. Once a type
is tagged, you usually want a hetrogeneous file anyway (that is, the type
probably ought to be T'Class, which isn't going to work with Direct_IO, and
is dubious with Sequential_IO).
Randy.
.
- Follow-Ups:
- Re: Direct_IO and files of tagged types
- From: Dmitry A. Kazakov
- Re: Direct_IO and files of tagged types
- References:
- Direct_IO and files of tagged types
- From: John McCormick
- Re: Direct_IO and files of tagged types
- From: Dmitry A. Kazakov
- Direct_IO and files of tagged types
- Prev by Date: Re: Using GNAT.Sockets with Streams and Byte Swapping
- Next by Date: SWIG - Rod Kay
- Previous by thread: Re: Direct_IO and files of tagged types
- Next by thread: Re: Direct_IO and files of tagged types
- Index(es):
Relevant Pages
|