comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Krischik" <Martin.Krischik@T-Online.de>
Subject: Re: Deference question
Date: Wed, 26 Feb 2003 20:30:50 +0100
Date: 2003-02-26T20:30:50+01:00	[thread overview]
Message-ID: <pan.2003.02.26.19.30.50.89193@T-Online.de> (raw)
In-Reply-To: 1d13e1b4.0302260734.7b26fece@posting.google.com

On Wed, 26 Feb 2003 07:34:03 +0000, Papandopulo wrote:

> Maybe simple question, but I am just starting with Ada.
> 
> I try to read an array from file using streams:
> 
> declare
>   type X_Value is mod 2**8;
>   type X_Buffer is array (Positive range <>) of X_Value;
>   type X_Buffer_Access is access all X_Buffer;
>   type X_Buffer_Sz is new X_Buffer (1 .. Positive(Q_Bytes));
>   type X_Buffer_Sz_Access is access all X_Buffer_Sz;
>   Buff    : X_Buffer_Sz_Access;
> begin
>   Buff := new X_Buffer_Sz;
>   X_Buffer_Sz'Read (X_Stream, Buff'all);

Typo: it is .all but 'Access.

Ada does not need as many pointer. So unless there is a good reason
against it I would suggest:

  Buff    : X_Buffer_Sz;
begin
  X_Buffer_Sz'Read (X_Stream, Buff);

> end;
> 
> But gnat tells me:
> attribute designator expected
> on the dereference (Buff'all)
> 
> What's wrong ?

With regards

Martin

-- 
Martin Krischik
mailto://Martin@krischik.com
http://www.ada.krischik.com




      parent reply	other threads:[~2003-02-26 19:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-26 15:34 Deference question Papandopulo
2003-02-26 19:06 ` Stephen Leake
2003-02-26 19:30 ` Martin Krischik [this message]
replies disabled

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