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,1cf653444208df72 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-15 21:52:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!dca6-feed2.news.digex.net!intermedia!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!wn3feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail From: "David Thompson" Newsgroups: comp.lang.ada References: <9pgr68$7pu1@news.cis.okstate.edu> <3bbd6287.346843109@news.cis.dfn.de> Subject: Re: ada vs. cpp X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: Date: Tue, 16 Oct 2001 04:52:02 GMT NNTP-Posting-Host: 12.89.134.143 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1003207922 12.89.134.143 (Tue, 16 Oct 2001 04:52:02 GMT) NNTP-Posting-Date: Tue, 16 Oct 2001 04:52:02 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:14627 Date: 2001-10-16T04:52:02+00:00 List-Id: Dmitry Kazakov wrote : ... > Sorry, but Ada is one of rare languages which are able to manipulate > strings allocated on the stack. IMO strings are indeed one of Ada > strengths, especially if you need an efficient parsing code. ... COBOL, post-1977 (IIRC) versions of Fortran, and (standard) Pascal support ordinary local (or global/static) variables containing some (fixed) number of characters treated (to greater or lesser extent) as character strings. Many Pascals support counted strings (that is, variable up to a declared limit) as an extension. Fortran and later Pascal allow a subprogram parameter to accept string arguments of different (fixed) sizes, a limited kind of genericity. (On most separate-compilation implementations and even some without you can cheat and access outside the declared bound(s) or length of a parameter and it always works right as long as it is within the actual argument, but this is not formally a feature except in the BCPL-C lineage where an array parameter is _defined_ to actually be a pointer with the bound discarded.) PL/1 supports CHAR(n) fixed-length and VARYING variables, and generic-length parameters. FWIW SQL also has fixed and variable length character string data types; true SQL has no local or "stack" variables of any type, but SQLoid PLs like Sybase/M$ T-SQL and Oracle PL/SQL do. C (and C++) can locally or statically allocate a char array and treat it as a string given the null-termination convention; in C++ a user or 3rdparty class could do fixed and/or variable strings like all those above, including generic-length using a templated proxy, though none are provided by the standard. In C99 (not yet widely implemented) or GNU C a local array variable (char or otherwise) can have a bound determined at the equivalent of elaboration, and PL/1 has always had this. Perhaps you meant to say C is the only widespread 3GL (besides arguably FORTH and maybe early BASIC?) that _didn't_ have character strings as an "official" datatype :-? In this area (as others) Ada did a good job of collecting, organizing, and making uniform pretty much all the functions available in other 3GLs, but did not break significant new ground. Which I hasten to say is still a valuable and even vital contribution. > > In any case, as many have pointed, it is a bit ridiculous to compare > Ada's strings with C++ having no strings at all. > As previously noted C++ std::string is closely comparable to Ada.Strings.Unbounded (and dynamically allocated). -- - David.Thompson 1 now at worldnet.att.net