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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e6c9800e35ccfeee X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: GNAT: Performance of String functions Date: 1997/07/24 Message-ID: #1/1 X-Deja-AN: 258689565 References: <5r1l6e$e0h$1@ratatosk.uio.no> <1997Jul22.071638.1@eisner> <33D4F30F.5299@online.no> <5r5cfh$irn$1@ratatosk.uio.no> <33D74581.DEC93419@elca-matrix.ch> <5r7n83$b37$1@ratatosk.uio.no> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-07-24T00:00:00+00:00 List-Id: Tarjei says <<> Mats Weber writes: > > subtype Length_Range is Natural range 0 .. Max_Length; > > type Bounded_String (Length : Length_Range := 0) is record > Data : String (1 .. Length); > end record; > As father Jones informes his son: Our situation has not improved. The alternative bounded string is just an unbounded string. That means that there is a potential copy of the string each time the size changes. This may be worse than the original GNAT version of bounded string wich only performs the copy on assignment. I don't think the real time people would be happy with the above solution. I don't think they like to think of what it might do to the heap. I'm not particulary happy with the solution either. >> I agree that this is a dubious choice. The trouble is that with this representation you CANNOT change the length of an existing value, you can ONLY assign to change the length. With this representation, I would be stronger than Tarjei and say "there is a copy" not "there is a potential copy", since it is really hard to imagine a compiler that avoids the copy on the full record assignment needed to change the length.