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