From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9208806da73239cc X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Pointers in Ada References: <6acda821.0503040425.3b437e6a@posting.google.com> In-Reply-To: <6acda821.0503040425.3b437e6a@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <0L1Wd.824$oO4.709@newsread3.news.pas.earthlink.net> Date: Fri, 04 Mar 2005 18:26:04 GMT NNTP-Posting-Host: 4.254.206.73 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1109960764 4.254.206.73 (Fri, 04 Mar 2005 10:26:04 PST) NNTP-Posting-Date: Fri, 04 Mar 2005 10:26:04 PST Xref: g2news1.google.com comp.lang.ada:8627 Date: 2005-03-04T18:26:04+00:00 List-Id: 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