home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!wupost!cs.uiuc.edu!sparc0b!pjl
- From: pjl@cs.uiuc.edu (Paul Lucas)
- Subject: Re: Variable length array in C++
- Message-ID: <C0G4E9.3D0@cs.uiuc.edu>
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <SHIBUYA.92Dec28120216@chute.bl.applicon.slb.com>
- Distribution: usa
- Date: Wed, 6 Jan 1993 18:51:44 GMT
- Lines: 19
-
- In <SHIBUYA.92Dec28120216@chute.bl.applicon.slb.com> shibuya@bl.applicon.slb.com (Hiroto Shibuya) writes:
-
- >Question from C minded programmer.
-
- >What is a simple way in C++ to implement variable length array - an
- >array which grow in size as needed? In C, I often use realloc to
- >reallocate an array to bigger size, but in C++, there is no
- >corresponding "renew" (?). Do I have to revert to malloc and realloc?
- >My understanding was that I never have to use malloc in C++.
-
- *****> No; new a new array; copy old to new; delete old.
-
-
- >Description of class "Blocks" in USL standard components sounds like
- *****> You're right.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-