Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ames!vsi1!octopus!sjsumcs!horstman From: horstman@sjsumcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Overloaded operator new Keywords: C++ Message-ID: <1990Dec4.062015.6637@sjsumcs.sjsu.edu> Date: 4 Dec 90 06:20:15 GMT Reply-To: horstman@sjsumcs.SJSU.EDU (Cay Horstmann) Organization: San Jose State University Lines: 26 One of my students just had the bright idea to abuse the placement syntax of the new operator new (p) X(...); to overload X::operator new( size_t, void* ) and feed something entirely different into p than the "placement address". I told her that was a subversive idea, but then I looked into the ARM and saw that it is possible to overload X::operator new( size_t, int) and make a call new(7) X(...). Is this stuff actually useful? I guess someone must have thought it is. I grant that the placement operation has its use, but I was always mystified by its syntax. I mean, if you call the destructor explicitly with p->~X(), why not call the constructor explicitly with p->X(...) instead of new(p) X(...) (provided nobody tinkered with the definition of X::operator new().) Any info (preferably by e-mail; I'll summarize if there is interest) would be greatly appreciated. Hate mail too... Cay Brought to you by Super Global Mega Corp .com