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,ab1d177a5a26577d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!x1g2000yqb.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: What's wrong with C++? Date: Thu, 17 Feb 2011 00:31:52 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <1ee1a434-4048-48f6-9f5e-d8126bebb808@r19g2000prm.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1297931512 17706 127.0.0.1 (17 Feb 2011 08:31:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 17 Feb 2011 08:31:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x1g2000yqb.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.6) Gecko/2009012111 Red Hat/3.0.6-1.el5 Firefox/3.0.6,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18298 Date: 2011-02-17T00:31:52-08:00 List-Id: KK6GM wrote on comp.lang.ada: > This is a serious question, seeking objective information. =A0I've > worked with C for many years and I have a very good understanding of > its weaknesses, which are many. =A0I haven't done nearly so much C++, > and what I have done was not very intensive (didn't use a great many C+ > + features), so I don't have a good understanding of its weaknesses. > > So, without turning into a bash-fest, what are some general-consensus > weaknesses or failures or problems with C++? =A0Comparisons with Ada are > welcome but not required. =A0And my focus is in the embedded & real-time > arenas, FWIW. Besides the other flaws mentioned in this thread, C++ lacks the equivalent of Ada's named access types. type T is record null; end record; type T_Access_One is access T; for T_Access_One'Storage_Pool use Pool_One; type T_Access_Two is access T; for T_Access_Two'Storage_Pool use Pool_Two; In Ada, the two named access types are incompatible with one another; they have no structural equivalence. Also you can declare the access types in a nested scope such that the compiler will detect any pointers leaking out of that scope. And don't get me started on the address arithmetic in C++... (I don't like anonymous access types at all, neither in C++ nor in Ada). The ISO technical report TR 24772:2010 about programming language vulnerabilities[1] should be the definitive reference. The appendices for Ada and SPARK are already complete and have been published in the Ada User Journal[2] and in the SIGAda Letters. I wonder what the status of the C++ appendix is. Does anyone here know? [1] http://www.iso.org/iso/catalogue_detail.htm?csnumber=3D41542 [2] http://www.ada-europe.org/AUJ/index.html The Ada appendix is in Volume 31, Issue 3 (September 2010) The SPARK appendix is in Volume 31, Issue 4 (December 2010) -- Ludovic Brenta.