home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / std / cplus / 1977 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.3 KB  |  46 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!darwin.sura.net!max.fiu.edu!serss0!feathers
  3. From: feathers@serss0 (Michael Feathers)
  4. Subject: Overloading operator delete
  5. Organization: Florida International University, Miami
  6. Date: Wed, 6 Jan 1993 03:20:00 GMT
  7. Message-ID: <C0Ex9D.Ct7@fiu.edu>
  8. Sender: news@fiu.edu (Usenet Administrator)
  9. Lines: 35
  10.  
  11.  
  12. I discovered the hard way a while ago that the operator delete can not be
  13. overloaded in C++.
  14.  
  15. I've read the annotation in the ARM and I can not say that I agree with
  16. the reasoning.  One example given for overloading operator new involves using 
  17. another arena for allocation.  But how will this memory be deallocated? 
  18.  
  19. Doesn't the possibility of using the global delete accidently make the 
  20. absence of an overloadable delete at least as "hazardous" as allowing it?
  21.  
  22. I understand that there are many applications in which programmers may not
  23. be concerned with reclaiming memory, but aren't there enough to justify being
  24. able to use operator delete symmetrically with operator new without resorting
  25. to the work around discussed in the ARM?
  26.  
  27. The work around that I've choosen involves using a set of malloc/free type
  28. functions since I have no means of using an overloaded delete symmetrically 
  29. with an overloaded new.
  30.  
  31. Michael Feathers   [feathers@fiu.edu]
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.