comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Optimising string handling in application
Date: Wed, 02 Apr 2003 18:23:20 GMT
Date: 2003-04-02T18:23:20+00:00	[thread overview]
Message-ID: <sUFia.44007$OV.142208@rwcrnsc54> (raw)
In-Reply-To: 1049267738.39983@edh3

>     declare
>        Dummy : constant String :=
>          Msg (1 .. Stop_First_String) &
>          Callsign(1 .. Callsign_Length) &
>          Msg (Start_Next_String .. Msg_Length);
>     begin
>        Msg_Length := Dummy'Length;
>        Msg (1 .. Msg_Length) := Dummy;
>     end;

  You don't need the temporary (Dummy) string.  Just calculate the
length first,
      Msg_Length := Msg_Length
                    - (Start_Next_String-Stop_First_String-1)
                    + Callsign_Length;
then set Msg(1 .. Msg_Length) to the concatenation.

> since I'm calling this all over the place and need the fixed length types
>...
>     (Msg             : in out Dpu_Loc_Messages.T_Msg_Data_Str;
>      Msg_Length      : in out T_Integer_32;
>      Callsign        : in     Dpu_Loc_Messages.T_Msg_Callsign;
>      Callsign_Length : in     Positive) is
  Ah, so your abstract type is not "String", but rather a home-grown
version of Bounded_String that passes the current length as a separate
variable.  Let me guess where this code originated...



  reply	other threads:[~2003-04-02 18:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01 11:54 Optimising string handling in application Frode Tenneboe
2003-04-01 18:52 ` Jeffrey Carter
2003-04-02  3:17 ` Steve
2003-04-02  4:10 ` tmoran
2003-04-02  7:15   ` Frode Tenneboe
2003-04-02 18:23     ` tmoran [this message]
2003-04-04 10:13       ` Frode Tenneboe
2003-04-04 13:26         ` Preben Randhol
2003-04-04 14:42           ` Frode Tenneboe
2003-04-04 21:48             ` Warren W. Gay VE3WWG
2003-04-05  7:24               ` Pascal Obry
2003-04-04 14:08         ` Frank J. Lhota
2003-04-04 15:26           ` Robert Spooner
2003-04-04 21:49             ` Warren W. Gay VE3WWG
2003-04-04 17:43         ` tmoran
2003-04-04 21:42           ` Frode Tennebø
2003-04-02 19:03     ` tmoran
2003-04-04 10:44       ` Frode Tenneboe
2003-04-05  3:28         ` tmoran
2003-04-05  0:08     ` Jeffrey Carter
replies disabled

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