Re: realloc equivalent in C++
Posted in 1996
hzhou@r26n05.tc.cornell.edu (Honbo Zhou) wrote: >Is there anything in C++ equvalent to realloc in C which can be used >to increase allocated memory? Can't find this even in C++ books which >talk about memory management specifically. Thanks. Honbo If you "malloc" in C++, you can still "realloc". If, however, you are asking if there is a way to reallocate something that you did a "new" on, then the answer is no, unless you write your own reallocation function for your classes. My understanding as to why C++ does not allow a "re-new" is because you are not dealing with raw bits (like you are with a malloc), you are dealing with live objects which have constructors associated with them. That's all I know. -- Regards, Marco DeFreitas Sikorsky Aircraft Stratford, CT