From: Jeffrey Carter <spam@spam.com>
Subject: Re: Pointers in Ada
Date: Fri, 04 Mar 2005 18:26:04 GMT
Date: 2005-03-04T18:26:04+00:00 [thread overview]
Message-ID: <0L1Wd.824$oO4.709@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <6acda821.0503040425.3b437e6a@posting.google.com>
Sebastian wrote:
> package Mdp_Lld;
> type Message_Header is
> record
> Word_Count : Byte;
> Command_Id : Byte;
> end record;
>
> subtype Mdp_Message_Data is Byte(1..500);
>
> type A_Mdp_Message is
> record
> Header : aliased Message_Header;
> Data : aliased Mdp_Message_Data;
> end record;
>
> type Driver_Msg_Ptr_Type is access all A_MDP_Message;
>
> procedure Put_Message
> (Msg_Buffer_Ptr : in out Client_Msg_Ptr_Type;
> );
As you're no doubt aware, this won't compile. In addition to the syntax
error in the declaration of Put_Message, Client_Msg_Ptr_Type has not
been declared.
Before we can answer your questions, we need to know why you're using
pointers. What wrong with
procedure Put_Message (Message : in An_Mdp_Message);
?
In Ada pointers are needed far more rarely than in some other languages.
Since you're not building a dynamic data structure, it's likely that you
don't need them. If you really do need them, it's probably a better
design to hide them from the clients of the package. That way you can
localize the memory management to your package.
--
Jeff Carter
"Saving keystrokes is the job of the text editor,
not the programming language."
Preben Randhol
64
next prev parent reply other threads:[~2005-03-04 18:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-04 12:25 Pointers in Ada Sebastian
2005-03-04 13:03 ` Adrien Plisson
2005-03-04 18:26 ` Jeffrey Carter [this message]
2005-03-05 15:47 ` Sebastian
-- strict thread matches above, loose matches on Subject: below --
2001-11-14 18:16 pointers " lalasa ala
2001-11-14 18:46 ` Matthew Heaney
2001-11-14 19:04 ` Preben Randhol
2001-11-14 20:10 ` Stephen Leake
2001-11-15 7:32 ` Preben Randhol
2001-11-15 14:00 ` David Botton
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox