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,2925b133078d1557 X-Google-Attributes: gid103376,public From: clines@delete_this.airmail.net (Kevin Cline) Subject: Re: Flexible Strings (was Equality operator...) Date: 1997/05/02 Message-ID: <3F2AA8DEC61418AE.502E81A8ECA1C4E7.3A25DE2FB38755A4@library-proxy.airnews.net>#1/1 X-Deja-AN: 238816017 References: <9704301422.AA07755@most> X-Orig-Message-ID: <336a6483.3146543@news.airmail.net> Organization: INTERNET AMERICA NNTP-Proxy-Relay: library.airnews.net Newsgroups: comp.lang.ada Date: 1997-05-02T00:00:00+00:00 List-Id: mheaney@ni.net (Matthew Heaney) wrote: >In article <9704301422.AA07755@most>, "W. Wesley Groleau (Wes)" > wrote: > >>I never had a problem implementing an Ada-83 equivalent of bounded strings >>so that no heap was required. Did it pretty much as Matt Heaney suggested, >>after reviewing a couple of "free" dynamic_strings packages and finding >>that nearly every operation leaked heap. > >Many people don't realize that Ada was more or less designed to that you >don't have to use heap. Heap usage is required for programs which solve problems whose size is unknown and run on machines with unknown memory resources. Embedded applications don't have these requirements, so dynamic allocation wasn't interesting to the Ada '83 design team. > >The problem with Ada 83 is that when you do need it, memory leaks are bound >to happen, because clients often forget to clean up the data structure. >Thankfully, this has been corrected in Ada 95. Too late, too late... >Explicit_Conversion: >declare > SA : constant String_Buffer_Array := ( > To_String_Buffer ("I'd"), > To_String_Buffer ("gladly"), > To_String_Buffer ("lose"), > To_String_Buffer ("me"), > To_String_Buffer ("to"), > To_String_Buffer ("find"), > To_String_Buffer ("you")); This is about the point where C++ programmers turn away laughing.