implementation of delete[] operator

Assume code like:

1
2
int* x = new x[100];
delete[] x;


The delete[] operator doesn't take in the size of the array to delete! Where is the size of the new'd array stored?

Thanks,
eeh

short answer: Don't worry about it. It's magic.

longer answer: Exact implementation depends on the compiler and/or the new[] and delete[] operator overload. There's no way to say for certain how it's done without getting into compiler specifics -- and so it may change from compiler to compiler (or even in different versions of the same compiler).
Topic archived. No new replies allowed.