comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: [newbie] Need som feedback on code snip
Date: 1999/10/22
Date: 1999-10-22T00:00:00+00:00	[thread overview]
Message-ID: <7uqilp$g1p$1@nnrp1.deja.com> (raw)
In-Reply-To: m31zan4l1n.fsf@kiuk0156.chembio.ntnu.no

In article <m31zan4l1n.fsf@kiuk0156.chembio.ntnu.no>,
  Preben Randhol <randhol@pvv.org> 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.




  reply	other threads:[~1999-10-22  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-22  0:00 [newbie] Need som feedback on code snip Preben Randhol
1999-10-22  0:00 ` Ted Dennison [this message]
1999-10-22  0:00   ` Ted Dennison
1999-10-22  0:00 ` [newbie] Need some " Matthew Heaney
1999-10-22  0:00 ` [newbie] Need som " Robert I. Eachus
1999-10-24  0:00   ` Preben Randhol
replies disabled

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