home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!rutgers!ub!toz!cyberman
- From: cyberman@toz.buffalo.ny.us (Cyberman)
- Newsgroups: comp.lang.c++
- Subject: Re: malloc or new in c++
- Message-ID: <gate.8NagqB1w165w@toz.buffalo.ny.us>
- Date: 2 Sep 92 01:44:06 GMT
- Lines: 34
- X-Maildoor: WaflineMail 1.00r
-
-
- -=> Chuang He spoke of "malloc or new in c++" <=-
- To All at 08-31-92 19:44
- CH> I have written a program by using C++. The compiler is Sun C++ 2.1. I
- CH> find a very interesting thing. I find two structure pointer set by
- CH> malloc or new have the same address. That means if I change the content
- CH> of one pointer pointing to will also change the other's. But these two
- CH> pointers are unrelated. I don't know why. Does this mean that I use to
-
- 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].
-
- CH> much new or malloc that no more memory I can use? Could anyone tell me
- CH> about how many memories can one program use, I mean use by new or
- CH> malloc. My machine is Sparcsation-SLC. The system is SunOS 4.1.1. It
- CH> would be appreciated that someone can tell me the reason and the
- CH> solution.
-
- 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.
-
- CH> Please send me an email. I do not read this newsgroup quite often.
-
- Sorry I can't do that with my current mail program. I hate it
- when that happens.
-
- Stephen Cyberman@Toz.Buffalo.NY.US
- Scripted at Tue 09-01-1992 00:24:50
-
- ... Initialise reality before use.
- --- Blue Wave/QWK v2.10
-
-