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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,789b3fa522bdcc2a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-02 10:23:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Optimising string handling in application References: <1049267738.39983@edh3> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1049307800 12.234.13.56 (Wed, 02 Apr 2003 18:23:20 GMT) NNTP-Posting-Date: Wed, 02 Apr 2003 18:23:20 GMT Organization: AT&T Broadband Date: Wed, 02 Apr 2003 18:23:20 GMT Xref: archiver1.google.com comp.lang.ada:35897 Date: 2003-04-02T18:23:20+00:00 List-Id: > 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...