A
alariq
can i do this without any harm (assuming that type MyType does not
allocate ANY memory in heap)
MyType* pmytype = new MyType[10];
// do some stuff
delete pmytype;
AFAIK, it will free memory allocated for 10 instances of MyType but
will not call destructors (which i do not need) and nothis bad will
happen. Moreover i saw such code when working with native types (such
as char/int/etc) in production code.
What does standard says in this case?
Thanks
allocate ANY memory in heap)
MyType* pmytype = new MyType[10];
// do some stuff
delete pmytype;
AFAIK, it will free memory allocated for 10 instances of MyType but
will not call destructors (which i do not need) and nothis bad will
happen. Moreover i saw such code when working with native types (such
as char/int/etc) in production code.
What does standard says in this case?
Thanks