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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e0e90ec4aca40043 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-25 18:52:37 PST Path: archiver1.google.com!news2.google.com!newsfeed.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!news.mindspring.net!not-for-mail From: Lao Xiao Hai Newsgroups: comp.lang.ada Subject: Re: Ada The Best Language? Date: Wed, 25 Jul 2001 18:53:21 -0700 Organization: AdaWorks Software Engineering Message-ID: <3B5F7811.5245FAE1@ix.netcom.com> References: Reply-To: richard@adaworks.com NNTP-Posting-Host: 9e.fc.c5.3d Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 26 Jul 2001 01:52:06 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:10580 Date: 2001-07-26T01:52:06+00:00 List-Id: ANH_VO@udlp.com wrote: > Codesavvy, for a start, can a linked list be implemented in C++ without pointer? Ahn, Yes it can. Well, yes it can if what you mean by a pointer is a raw pointer. Sadly, this is the kind of pointer most C++ programmers routinely use. Ada raises the level of abstraction and calls a pointer an access type (as Java calls it a reference), thereby hiding the dangerous aspects of indirection beneath a compiler-enforced mechanism. In the case of Ada, a pointer, AKA access type, is safe by default. A C++ pointer is unsafe, by default. We can relax the safety features of an access type through a variety of unchecked and library features. In C++, we raise the level of abstraction through the use of a "smart pointer" class. This, in many ways, is equivalent to an access type, except it may have built-in garbage collection. The smart pointer restricts the set of operations on an object of its type in much the same way an access type does in Ada. Unfortunately, most C++ programmers either do not understand how to use smart pointers or regard them as "inefficient." Also, few college professors know enough about them to properly teach their use in object-oriented programming classes. Richard Riehle