Path: utzoo!utgpu!watmath!clyde!att!pacbell!ames!ucsd!orion.cf.uci.edu!paris.ics.uci.edu!blanche.ics.uci.edu!schmidt From: schmidt@blanche.ics.uci.edu (Doug Schmidt) Newsgroups: comp.lang.c++ Subject: realloc and new Message-ID: <946@paris.ics.uci.edu> Date: 20 Nov 88 05:22:09 GMT Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt Organization: University of California, Irvine - Dept of ICS Lines: 43 References: 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.