Xref: utzoo comp.lang.c++:11442 comp.std.c++:570 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tekchips!tekcrl!brucec From: brucec@phoebus.labs.tek.com (Bruce Cohen;;50-662;LP=A;) Newsgroups: comp.lang.c++,comp.std.c++ Subject: question re overloaded operator new() and constructors Message-ID: Date: 5 Feb 91 00:55:35 GMT Sender: news@tekchips.LABS.TEK.COM Followup-To: comp.lang.c++ Organization: Tektronix Inc. Lines: 23 Section 5.3.3 (page 61) of the ARM states: "Whether operator new allocates the memory itself or leaves that up to the constructor when creating an object of a class with a constructor is implementation dependent. O It will, however, always be allocated without the intervention of the programmer. Calling operator new() as part of the implementation of an allocation-expression is the task of an implementation." Could someone please explain to me how one can then guarantee that an overloaded operator new() can do the right thing in regards to allocation? In other words, if it's up to the compiler writer whether the constructor allocates or not, how can I, as a programmer, put special purpose allocation into my new? Or should there be an additional statement in the ARM to the effect that constructors of classes which overload new() cannot allocate memory? -- ------------------------------------------------------------------------ Speaker-to-managers, aka Bruce Cohen, Computer Research Lab email: brucec@tekchips.labs.tek.com Tektronix Laboratories, Tektronix, Inc. phone: (503)627-5241 M/S 50-662, P.O. Box 500, Beaverton, OR 97077