home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13433 < prev    next >
Encoding:
Internet Message Format  |  1992-09-09  |  1.7 KB

  1. Path: sparky!uunet!lhdsy1!kato.lahabra.chevron.com!hwrvo
  2. From: hwrvo@kato.lahabra.chevron.com (W.R. Volz)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: malloc or new in c++
  5. Message-ID: <6649@lhdsy1.lahabra.chevron.com>
  6. Date: 9 Sep 92 16:45:26 GMT
  7. References: <gate.8NagqB1w165w@toz.buffalo.ny.us>
  8. Sender: news@lhdsy1.lahabra.chevron.com
  9. Organization: Chevron Oil Field Research Company
  10. Lines: 31
  11.  
  12. In article <gate.8NagqB1w165w@toz.buffalo.ny.us>, cyberman@toz.buffalo.ny.us (Cyberman) writes:
  13. |> 
  14. |>      -=> Chuang He spoke of "malloc or new in c++" <=-
  15. |>     To All at 08-31-92  19:44
  16. |>  The FAQ states NOT to use malloc in C++ programs it's thier only
  17. |>  for backwards compatibility [ie compile older files on a C++
  18. |>  compilor].
  19. |> 
  20. |> Yes use ALL new and delete statements and eliminate all malloc
  21. |> and free function calls!  This will more than likely solve at
  22. |> least 1 potential problem.
  23. |> 
  24.  
  25. Let me get this straight: Are you saying that there is a problem of using
  26. malloc in a c++ program? I realize that if I malloc some memory, then
  27. I need to free it with free(). And if a create a new object with new, then I
  28. delete with delete. I wouldn't 'free' an object allocated with 'new' and 
  29. 'delete' an object allocated with 'malloc'. But if there is an incompatibility 
  30. in c++ between (malloc,free) and (new,delete), I don't know how one can mix
  31. any program that uses both allocatation schemes. This would seem to indicate
  32. that all existing code would have to be rewritten. It this true. If so, it
  33. could just spell the death of c++. The c code base is just too large.
  34.  
  35. -- 
  36.  
  37. ======================
  38. Bill Volz
  39. Chevron Oil Field Research Co.
  40. Exploration Research/Geophysics Division.
  41. P.O. Box 446, La Habra, CA 90633-0446
  42. Phone: (310) 694-9340
  43.