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 11:46:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread4.news.pas.earthlink.net.POSTED!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 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> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <_XYgb.3237$dn6.2766@newsread4.news.pas.earthlink.net> Date: Wed, 08 Oct 2003 18:46:18 GMT NNTP-Posting-Host: 63.184.9.16 X-Complaints-To: abuse@earthlink.net X-Trace: newsread4.news.pas.earthlink.net 1065638778 63.184.9.16 (Wed, 08 Oct 2003 11:46:18 PDT) NNTP-Posting-Date: Wed, 08 Oct 2003 11:46:18 PDT Xref: archiver1.google.com comp.lang.ada:488 Date: 2003-10-08T18:46:18+00:00 List-Id: 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. Basically, you have reinvented the wheel. What you have is Unbounded_String, but with its guts hanging out all over the place, instead of using information hiding as a software engineer should, and as Ada.Strings.Unbounded does. > I found myself desingning more and debugging less. There were still > problems > of course, such as pass by value or pass by reference; I didn't know what to > use > nor did I know if I had to specify it. I found out when I created my first > graph, > you have to specify out paramter or in and out for the parameter or you get > a > copy instead of the actual "thing". This represents a serious misunderstanding of Ada parameter modes. All elementary types are passed by copy, regardless of the parameter mode. All tagged and limited types are passed by reference, regardless of the parameter mode. For all other types, the compiler chooses the parameter mode best suited to the type. Mode in means the subprogram receives a value from the caller, and cannot modify it; out means the subprogram provides a value to the caller, and in out means the caller provides a value which the subprogram may modify. Parameter modes have nothing to do with parameter passing mechanisms. See ARM 6.2. -- Jeff Carter "I blow my nose on you." Monty Python & the Holy Grail 03