comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Usage of Ada.Streams
Date: 2000/01/19
Date: 2000-01-19T00:00:00+00:00	[thread overview]
Message-ID: <V6ih4.13$J4.768@newsread1.prod.itd.earthlink.net> (raw)
In-Reply-To: 863vhk$qje$1@wanadoo.fr


Pascal Obry <p.obry@wanadoo.fr> wrote in message
news:863vhk$qje$1@wanadoo.fr...
> David C. Hoos, Sr. a �crit dans le message ...
> >If you want to have the tags in the stream (so that the specific
> >types can be distinguished when reading back), you need to use:
> >Data'Class'Output(Str, Data_Pointer.all);
> >
> >Then, to read them back, you would say:
> >Data_Pointer := new Data'Class'(Data'Class'Input (str));
> >
> >That statement allocates memory for the object, and initializes it
> >with the value read from the stream.
> >
>
> That's correct, but note that it is not necessary to use pointer under
> Ada95.

Agreed.  I only used an access type because the original poster was
writing from a dereferenced access object.

Also, local declare blocks, of course, are more restricted in scope than
dynamically-allocated objects.

Which to use depends on other considerations, but I would probably use
a storage pool if dynamically allocating, especially in a long-running
program reading from, say, a network stream.






  reply	other threads:[~2000-01-19  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-18  0:00 Usage of Ada.Streams Joerg Ruedenauer
2000-01-19  0:00 ` David C. Hoos, Sr.
2000-01-19  0:00   ` Pascal Obry
2000-01-19  0:00     ` David C. Hoos, Sr. [this message]
2000-01-19  0:00       ` Pascal Obry
replies disabled

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