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

  1. Path: sparky!uunet!cs.utexas.edu!rutgers!ub!toz!cyberman
  2. From: cyberman@toz.buffalo.ny.us (Cyberman)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: malloc or new in c++
  5. Message-ID: <gate.8NagqB1w165w@toz.buffalo.ny.us>
  6. Date: 2 Sep 92 01:44:06 GMT
  7. Lines: 34
  8. X-Maildoor: WaflineMail 1.00r
  9.  
  10.  
  11.      -=> Chuang He spoke of "malloc or new in c++" <=-
  12.     To All at 08-31-92  19:44
  13.  CH> I have written a program by using C++. The compiler is Sun C++ 2.1. I
  14.  CH> find a very interesting thing. I find two structure pointer set by
  15.  CH> malloc or new have the same address. That means if I change the content
  16.  CH> of one pointer pointing to will also change the other's. But these two
  17.  CH> pointers are unrelated. I don't know why. Does this mean that I use to
  18.  
  19.  The FAQ states NOT to use malloc in C++ programs it's thier only
  20.  for backwards compatibility [ie compile older files on a C++
  21.  compilor].
  22.  
  23.  CH> much new or malloc that no more memory I can  use? Could anyone tell me
  24.  CH> about how many memories can one program use, I mean use by new or
  25.  CH> malloc. My machine is Sparcsation-SLC. The system is SunOS 4.1.1. It
  26.  CH> would be appreciated that someone can tell me the reason and the
  27.  CH> solution.
  28.  
  29. Yes use ALL new and delete statements and eliminate all malloc
  30. and free function calls!  This will more than likely solve at
  31. least 1 potential problem.
  32.  
  33.  CH> Please send me an email. I do not read this newsgroup quite often.
  34.  
  35. Sorry I can't do that with my current mail program.  I hate it
  36. when that happens.
  37.  
  38.         Stephen Cyberman@Toz.Buffalo.NY.US
  39.         Scripted at Tue  09-01-1992  00:24:50
  40.  
  41. ... Initialise reality before use.
  42. --- Blue Wave/QWK v2.10
  43.                                        
  44.