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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny04.POSTED!0e8a908a!not-for-mail From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request References: <49dc98cf.0408110556.18ae7df@posting.google.com> <413e2fbd$0$30586$626a14ce@news.free.fr> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <2cR0d.1623$IO5.1267@trndny04> Date: Sun, 12 Sep 2004 05:32:46 GMT NNTP-Posting-Host: 68.160.201.96 X-Complaints-To: abuse@verizon.net X-Trace: trndny04 1094967166 68.160.201.96 (Sun, 12 Sep 2004 01:32:46 EDT) NNTP-Posting-Date: Sun, 12 Sep 2004 01:32:46 EDT Xref: g2news1.google.com comp.lang.ada:3604 Date: 2004-09-12T05:32:46+00:00 List-Id: Pascal Obry wrote: > That's why working with strings in C/C++ is a nightmare! strcpy/strcat,++,-- > and so on... Look at some real world C/C++ code handling strings ! > > For memory, a string in Ada is: > > type String is array (Positive range <>) of Character; > > And you can do something like: > > function Some_Value return String is > begin > return "..."; > end Some_Value; > > S1 : constant String := "a long string"; > S2 : constant String := "this is definitly " & S1 & Some_Value; > > S3 : constant String := S1 (S1'First + 2 .. S1'First + 5); I'm puzzled. Your Ada code translates line-for-line into C++: #include std::string sv() { return "..."; } int main() { std::string const s1("a long string"); std::string const s2("this is definitly " + s1 + sv()); std::string const s3(s1.begin() + 2, s1.begin() + 5 + 1); } Granted that the C++ code is using the equivalent of Ada's unbounded_string, I'd hardly call this a nightmare.