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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5f1e38db361b33e X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: [newbie] Need som feedback on code snip Date: 1999/10/22 Message-ID: <7uqilp$g1p$1@nnrp1.deja.com>#1/1 X-Deja-AN: 539276145 References: X-Http-Proxy: 1.0 x21.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Oct 22 20:50:02 1999 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I) Date: 1999-10-22T00:00:00+00:00 List-Id: In article , Preben Randhol wrote: > > comment on it. It works, but is is the Right Way to do it or is there > a smarter way. I'm learning Ada95 on my own and could need some > feedback from somebody experienced with Ada. > > with Text_IO; use Text_IO; > with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; > If it were me, I'd get rid of the "aliased", String_Ptr, and Text_Pointer (and the silly hungarian routine name). All you really need is: procedure My_Test is Text : Unbounded_String := To_Unbounded_String("Hello world!"); begin Put_Line(To_String(Text)); Text := To_Unbounded_String("Hello yourself!"); Put_Line(To_String(Text)); end My_Test; There's no point in aliasing things when you don't have to, and it can cause serious maintanence headaches in larger programs. -- T.E.D. Sent via Deja.com http://www.deja.com/ Before you buy.