home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11630 < prev    next >
Encoding:
Text File  |  1992-07-27  |  1.5 KB  |  35 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!sdl!adk
  3. From: adk@Warren.MENTORG.COM (Ajay Kamdar)
  4. Subject: strdup()  Was: Re: Renew?
  5. Message-ID: <1992Jul27.201834.13654@Warren.MENTORG.COM>
  6. Organization: Mentor Graphics Corp. - IC Group
  7. References: <23315@alice.att.com> <1992Jul25.151227.8156@hemlock.cray.com> <1992Jul27.173054.396@taumet.com>
  8. Date: Mon, 27 Jul 1992 20:18:34 GMT
  9. Lines: 24
  10.  
  11. In article <1992Jul27.173054.396@taumet.com> steve@taumet.com (Steve Clamage) writes:
  12. >There is no requirement that 'new', for example, have any relationship
  13. >whatever to 'malloc' or 'realloc'.  Either might be implemented in
  14. >terms of the other, or they might be independent implementations.  They
  15. >might even manage different address spaces. 
  16.  
  17. Given that new and malloc are not necessarily related, deleteing memory
  18. returned from strdup() [STRINGS(3)] could be a recipe for disaster since the
  19. returned memory is malloced and not newed. It is onerous to keep track of
  20. which memory is newed, and which is malloced. C++ code written using strdup()
  21. might work with one compiler but not with another if care is not exercised
  22. in freeing the returned memory.
  23.  
  24. Is there any move towards providing C++ified versions of functions like
  25. strdup() as part of some standard library? Right now the only solution
  26. I know is to implement my own version of such functions.
  27.  
  28. - Ajay
  29.  
  30. -- 
  31. I speak for none but myself.
  32.  
  33. Ajay Kamdar                               Email : ajay_kamdar@mentorg.com
  34. Mentor Graphics, IC Group (Warren, NJ)    Phone : (908) 580-0102
  35.