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,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-26 10:48:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: 26 Sep 2003 13:41:58 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <1064527575.648809@master.nyc.kbcfp.com> <3F739C1D.4030907@attbi.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1064598290 23963 128.183.235.92 (26 Sep 2003 17:44:50 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 26 Sep 2003 17:44:50 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: archiver1.google.com comp.lang.ada:43002 Date: 2003-09-26T17:44:50+00:00 List-Id: Matthew Heaney writes: > One nice thing about C++ std::string is that you have c_str() and data() > member functions, which give you a traditional nul-terminated const > char* and a non-nul terminated const char*, respectively. This makes it > trivial to build up a string using std::string (or its close cousin > std::ostringstream), and then to turn around and get the char* array > using c_str(), which means it can basically be used everywhere a const > char* can. > > The problem with Ada.Strings.Unbounded is that to do anything useful > with it requires a conversion to type String, which is grossly > inefficient, not to mention awkward. I don't find "To_String (An_Unbounded)" any more awkward than "A_String.data()". Please explain. As to "inefficient", that depends on the implementation. Hm, I guess you mean To_String almost always requires a copy. But if you use the result of To_String as the argument to a function, can't the Ada compiler optimize that to a reference? That's what I would expect. > The ACT people added a Aux child (I think that's the name), which > provides a function to return the underlying String_Access. This is > how Ada.Strings.Unbounded should have been designed in the first > place. I expect the compiler to achieve that level of effiency when I write the code in a way that makes it possible. > The C++ std::string also has a getline procedure to read from stdin > directly into a std::string. A similar function should have been > provided for Ada.Strings.Unbounded. True, and ACT did so. That would be a good candidate for Ada0Y -- -- Stephe