- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a List View control (report view)in a win32 program, and would like to create memory for the data in theList View control as the user adds items (or data rows). The user addsitems as he works with the program, so therewill be no way to predetermine the memory required.
Is there a way to incrementally allocate an array?
Thanks for any info.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not really, but you can use the new MOVE_ALLOC intrinsic to implement a "reallocate" without copying the data twice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using vs. 8.1... of IVF so I assume that the MOVE_ALLOC is in vs. 9.... From your post itsounds like this intinsic can be used to increase the size of an allocatable array without loosing data in the array. Is this correct?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not exactly.
Without MOVE_ALLOC you have to do what you want this way:
1. Allocate temporary array the same size as the old one.
2. Copy data from old array to temp
3. Deallocate old array
4. Allocate new array to new size
5. Copy data from temp
6. Deallocate temp
With MOVE_ALLOC you do this:
1. Allocate a temp array with the new size
2. Copy data from old to temp
3. Call MOVE_ALLOC (old,temp)
This causes the old array to be deallocated, the storage for the temp now belongs to the "old" array, and the temp array has the status unallocated.
MOVE_ALLOC is a 9.0 feature (in an update as of a few months ago.)
Without MOVE_ALLOC you have to do what you want this way:
1. Allocate temporary array the same size as the old one.
2. Copy data from old array to temp
3. Deallocate old array
4. Allocate new array to new size
5. Copy data from temp
6. Deallocate temp
With MOVE_ALLOC you do this:
1. Allocate a temp array with the new size
2. Copy data from old to temp
3. Call MOVE_ALLOC (old,temp)
This causes the old array to be deallocated, the storage for the temp now belongs to the "old" array, and the temp array has the status unallocated.
MOVE_ALLOC is a 9.0 feature (in an update as of a few months ago.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the info.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page