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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3885b7fd66a1db28 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-27 09:27:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: kcline17@hotmail.com (Kevin Cline) Newsgroups: comp.lang.ada Subject: Re: Why is Ada a good choice for an ambitious beginner to programming Date: 27 Dec 2002 09:27:48 -0800 Organization: http://groups.google.com/ Message-ID: References: <5ad0dd8a.0212210251.63b87aba@posting.google.com> <5ad0dd8a.0212230352.11f8b886@posting.google.com> <5ad0dd8a.0212231215.6ae81bf7@posting.google.com> <7WdO9.115704$4W1.35198@nwrddc02.gnilink.net> NNTP-Posting-Host: 192.76.54.20 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1041010068 16541 127.0.0.1 (27 Dec 2002 17:27:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 27 Dec 2002 17:27:48 GMT Xref: archiver1.google.com comp.lang.ada:32334 Date: 2002-12-27T17:27:48+00:00 List-Id: Hyman Rosen wrote in message news:<7WdO9.115704$4W1.35198@nwrddc02.gnilink.net>... > Bill Findlay wrote: > > C++ beginners just *might* have to learn about placement new, > > to let them do things that are trivially easy in Ada; > > What's the Ada equivalent? Is it something like > > for v'address use (some expression) > > C++ "placement new" is somewhat more general - it's a way of > passing parameters to (and thereby also selecting by overload > resolution) a storage allocator. But it is trivially easy to > use - it looks something like > > Type *ptr = new(ap1, ap2, ap3) Type(tp1, tp2, tp3); > > The apn arguments are passed to the allocator selected by > overload resolution on them, and the tpn arguments are then > passed to the constructor of Type, which is built in the > space returned by the allocator. > > I don't think beginners need to learn about this, though. With the STL it's possible to write a lot of interesting and efficient C++ code without using new at all.