-
& the hat of GPL slaying
Realloc with new and delete
Ok after doing a search it appears there is no direct c++ equivlent to realloc. What I want to know is if it is safe to use realloc with new and delete. The type will be char (I'm just getting a chuck of memory) and constructors/destructors do not need to be invoked.
-
Registered User
>> What I want to know is if it is safe to use realloc with new and delete.
The generic awnser is no.
You can simulate realloc() using new and delete and memcpy(). If you need the efficiency of realloc() then use malloc() and free() for your char array.
gg
-
& the hat of GPL slaying
Popular pages
Recent additions