schmidt@blanche.ics.uci.edu (Doug Schmidt) (11/20/88)
Hi, Several recent postings on comp.lang.c utilizing realloc prompted me to write and ask whether mixing calls to new and realloc are guaranteed to work correctly with C++? For some reason it seems somewhat improper to mix the built-in free store allocator with the standard C library re-allocator, but other methods don't appear particularly satisfactory either. For instance, page 182 of Stroustrup's book illustrates a good example of ( new / delete ) pairs that might be better served with a realloc-type scheme ( better in the sense that re-copying of data could be avoided under certain circumstances best determined by the free-store management system ). Perhaps what is necessary is to introduce another memory management keyword, e.g.: ---------------------------------------- char *Foo = new char [ Size ]; // ... char *Bar = renew char [ Foo, Size * 2 ]; ---------------------------------------- Of course, the FSF's G++ could always make this an extension using the keyword ``regnu'' ( sorry, I couldn't resist! ). thanks, Doug Schmidt ---------------------------------------- schmidt@siam.ics.uci.edu (ARPA) | Per me si va nella cita dolente. | Per me si va nell' etterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza voi ch' entrate. -- schmidt@bonnie.ics.uci.edu (ARPA) | Per me si va nella cita dolente. | Per me si va nell' etterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza voi ch' entrate.