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,daca227a72518885 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-08 06:10:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!not-for-mail Message-ID: <3F840CBE.6080904@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Unbounded Strings References: <20031007175516.DC2884C40C8@lovelace.ada-france.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 08 Oct 2003 13:10:23 GMT NNTP-Posting-Host: 165.247.68.1 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1065618623 165.247.68.1 (Wed, 08 Oct 2003 06:10:23 PDT) NNTP-Posting-Date: Wed, 08 Oct 2003 06:10:23 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:459 Date: 2003-10-08T13:10:23+00:00 List-Id: Pointers to strings are certainly possible in Ada, but that's kind of a sign of a C/C++ programmer trying to utilize all their C/C++ idioms in a different language. I remember quite a while back watching a C guy struggling with Ada and trying to use 'Address everywhere in passing parameters like strings to subroutines. He was convinced he needed to do that to get a "by reference" parameter because he was so conditioned to think that way by C. Obviously, you *can* do it that way - its just not necessary and really makes your life harder. If you learn to utilize Ada's features with "Ada Idioms", you really don't need the pointers and dynamic allocation - at least not for normal string manipulation. You always *can* do it, but you don't have to do it. That tends to reduce the risks of dangling pointers and memory leaks, so you might want to try to learn "The Ada Way". :-) MDC Andrew Carroll wrote: > > I did some experimenting, thanks to Cohen's book and persistance I found > that I can define a pointer to a string type in Ada and allocate a new > string when > I want one of a different size, sort of like char* in C/C++, with the > benefits of > Ada bounds checking (if that still exist by default) and the memory > management I briefly scanned over in the last comp.lang.ada email. > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m c o n d i c @ a c m . o r g "All reformers, however strict their social conscience, live in houses just as big as they can pay for." --Logan Pearsall Smith ======================================================================