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-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada,comp.lang.c++ Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: 23 Mar 2005 13:41:08 -0800 Organization: http://groups.google.com Message-ID: <1111614068.866088.91600@f14g2000cwb.googlegroups.com> References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <1111607633.301232.62490@z14g2000cwz.googlegroups.com> <1111609026.080271.186990@g14g2000cwa.googlegroups.com> <1111609707.294612.108390@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: 66.162.65.162 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1111614073 8322 127.0.0.1 (23 Mar 2005 21:41:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 23 Mar 2005 21:41:13 +0000 (UTC) In-Reply-To: <1111609707.294612.108390@z14g2000cwz.googlegroups.com> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=66.162.65.162; posting-account=Zl1UPAwAAADEsUSm1PMMiDjihtBlZUi_ Xref: g2news1.google.com comp.lang.ada:9840 comp.lang.c++:46919 Date: 2005-03-23T13:41:08-08:00 List-Id: Jerry Coffin wrote: > > char[] and wchar_t[] are arrays, not strings. Well, that's true of Ada's String and Wide_String. > C++ really only has one > string type: std::basic_string. std::string and std::wstring are not > types of their own at all, but simply typedefs as: > > typedef std::basic_string string; > typedef std::basic_string wstring; That's more or less what type Unbounded_String is, too. There appears to be a difference in terminology. I and every other developer I know refers to type const char* as a string. (For example, H&S Ch. 13 is titled "String Processing.") In any event, that's probably how the OP was using the term when he said "Ada has 5 string types." If you don't regard arrays as members of the class of string types, then you can reduce Ada's count accordingly. > In addition, one of the major arguments the Ada fans have used here is > that Ada's strings are built-in, NOT added as a class like in C++. If > C++ had been designed from the beginning with a string class, the > array-based "stuff" probably wouldn't exist at all. I don't see what difference it makes whether the type is built-in or not. What's wrong with an added class? Perhaps they were refering to the fact that you can declare array objects (strings) with non-static bounds on the stack (since clearly Unbounded_String is not a built-in type). > BTW, in case anybody really cares, yes I apply the same standard to > C++: while its string handling facilities are fewer and IMO better than > Ada's, they're still far short of perfect. I prefer string handling in C++ too, but not being able to declare an array (on the stack) with non-static bounds is a real pain sometimes (although std::string mostly compensates for this). I agree that Ada's string handling facilities aren't as nice, but they do get the job done.