comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Direct_IO and files of tagged types
Date: Thu, 26 May 2005 20:22:38 +0200
Date: 2005-05-26T20:22:42+02:00	[thread overview]
Message-ID: <86bcmsy3e49m.yjhfcxtf7osr.dlg@40tude.net> (raw)
In-Reply-To: 1117128009.277967.14010@g14g2000cwa.googlegroups.com

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!

Anyway what about:

1. Aggregation: you put a plain record into tagged type and do I/O with
that record.

2. A completely independent record type used for external representation of
tagged objects.

3. Handles/smart pointers: tagged objects refer to a plain record type via
an access discriminant or an access type.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-05-26 18:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-26 17:20 Direct_IO and files of tagged types John McCormick
2005-05-26 18:22 ` Dmitry A. Kazakov [this message]
2005-05-26 23:51   ` Randy Brukardt
2005-05-27  8:38     ` 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