c++ - delete[] Array of characters -


possible duplicate:
delete[] supplied modified new-ed pointer. undefined behaviour?

let's i've allocated handful of characters using new char[number].

will possible delete few end characters (something delete[] (chararray + 4);, supposedly de-allocate of characters except first four)?

i read implementations' new[] store number of objects allocated before array of objects delete[] knows how many objects de-allocate, it's unsafe i'm asking...

thanks.

edit:

is manually deleting unwanted end bytes using separate delete statements safe way i'm asking?

the "safe" way allocate new array, copy data, , delete old one. or follow std::vector way , differentiate between "capacity" (the size of array) , "size" (the amount of elements in it).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -