home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18761 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.1 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!wupost!cs.uiuc.edu!sparc0b!pjl
  3. From: pjl@cs.uiuc.edu (Paul Lucas)
  4. Subject: Re: Variable length array in C++
  5. Message-ID: <C0G4E9.3D0@cs.uiuc.edu>
  6. Sender: news@cs.uiuc.edu
  7. Organization: University of Illinois at Urbana-Champaign
  8. References: <SHIBUYA.92Dec28120216@chute.bl.applicon.slb.com>
  9. Distribution: usa
  10. Date: Wed, 6 Jan 1993 18:51:44 GMT
  11. Lines: 19
  12.  
  13. In <SHIBUYA.92Dec28120216@chute.bl.applicon.slb.com> shibuya@bl.applicon.slb.com (Hiroto Shibuya) writes:
  14.  
  15. >Question from C minded programmer.
  16.  
  17. >What is a simple way in C++ to implement variable length array - an
  18. >array which grow in size as needed?  In C, I often use realloc to
  19. >reallocate an array to bigger size, but in C++, there is no
  20. >corresponding "renew" (?).  Do I have to revert to malloc and realloc?
  21. >My understanding was that I never have to use malloc in C++.
  22.  
  23. *****>    No; new a new array; copy old to new; delete old.
  24.  
  25.  
  26. >Description of class "Blocks" in USL standard components sounds like
  27. *****>    You're right.
  28. -- 
  29.     - Paul J. Lucas                University of Illinois    
  30.       AT&T Bell Laboratories        at Urbana-Champaign
  31.       Naperville, IL            pjl@cs.uiuc.edu
  32.