home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 12977 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.2 KB  |  54 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!timbuk.cray.com!hemlock.cray.com!dsf
  3. From: dsf@cray.com (Dan Frankowski)
  4. Subject: Re: help?? is their a method for solving dynamic allocation problemes in c++
  5. Message-ID: <1992Aug27.105627.14031@hemlock.cray.com>
  6. Lines: 43
  7. Organization: Cray Research, Inc.
  8. References: <1992Aug19.203838.20501@bmw.mayo.edu> <78304@ut-emx.uucp> <1992Aug27.092938.6768@hemlock.cray.com>
  9. Date: 27 Aug 92 10:56:27 CDT
  10.  
  11. In article <1992Aug27.092938.6768@hemlock.cray.com> dsf@cray.com (Dan Frankowski) writes:
  12. >In article <78304@ut-emx.uucp> jamshid@emx.utexas.edu writes:
  13. >>In article <1992Aug19.203838.20501@bmw.mayo.edu> staniszewski@mayo.edu writes
  14. >>[in lines annoyingly over 79 chars long]:
  15. >
  16. >>>The problem I am looking at is to trackdown where my dynamic memory
  17. >>>problems are using new and delete..
  18. >
  19. >>Why is overloading the global operator new() awkward? ..
  20. >> [code deleted]
  21.  
  22. >Also, my question is, will this cover the global new and delete?  It's
  23. >not an overloading.  A function may be overloaded only with different
  24. >signatures-- that is, if the parameter lists are different.  In this
  25. >case, you are trying to define the same function with the same
  26. >parameter list.  I've been trying to get it to work under g++ 1.37 and
  27. >cfront 3.0.1, and it hangs in both cases.  Should this work?  Why?
  28.  
  29. Sorry for the bandwidth.  I answered my own question (at least on a
  30. cfront-based compiler), and can't get the newsreader to cancel my
  31. article.
  32.  
  33. Answer#1: It will indeed "cover" global new and delete.  If the
  34. reference to new is resolved in the source code, the linker will
  35. never look for an external definition.
  36.  
  37. Answer#2: Hanging had something to do with using stream I/O in new.
  38. I used the default new, modified so the first line was
  39.  
  40. cout << "new: Allocating " << size << " bytes.\n";
  41.  
  42. If one of the ostream::operator<<()s somehow called new, that would
  43. explain it..
  44.  
  45. >(I want to assume global new and delete cannot be replaced-- or if
  46. >they can, that it will not show up as __nw__FUi() under cfront 3.0.1
  47. >name mangling.)
  48.  
  49. I can't assume any of that.  The user can replace new and delete,
  50. and they will cover the original functions.
  51.  
  52. -- 
  53. Dan Frankowski            Dan.Frankowski@cray.com     (612) 683-5099
  54.