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,927ae253da8bb547 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-31 14:25:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!spool0900.news.uu.net!reader0901.news.uu.net!not-for-mail Message-ID: <3CF7EA47.20909@mail.com> Date: Fri, 31 May 2002 17:25:27 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0rc3) Gecko/20020523 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Specialization References: <4519e058.0205300909.5bfb317d@posting.google.com> <3CF6CF7D.8000704@worldnet.att.net> <82347202.0205310608.2f7d634d@posting.google.com> <3CF7B571.2090901@mail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Cache-Post-Path: master.nyc.kbcfp.com!unknown@mosquito.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1022880317 reader1.ash.ops.us.uu.net 16798 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:25121 Date: 2002-05-31T17:25:27-04:00 List-Id: Sergey Koshcheyev wrote: > As for ordinary new, it does return you a pointer to a > fully initialized object, doesn't it? As does placement new. It's one of those silly overloaded C++isms again. There are two news. One is 'new-expression', and it is this that returns a pointer to a fully initialized object. The other is 'operator new' which returns a pointer to allocated but uninitialized storage. The 'new-expression' first calls 'operator new' to allocate storage, then builds the initialized object(s) in that storage. The key is that 'operator new' is actually an overloaded family of functions. One of those overloads takes an extra pointer parameter and simply returns it, and that is the form generally known as 'placement new'. That is, ordinary 'operator new' calls malloc (essentially) to get storage for the allocated object, while placement 'operator new' simply hands back what you give it, namely previously allocated storage. The syntax of a 'new-expression' includes the ability to specify additional parameters for 'operator new', which allows it to use placement 'operator new'.