Assume you have:
...
TYPEDEFD_TYPE * pointerToTYPE = (TYPEDEFD_TYPE*) new unsigned char[Multiple * sizeof(TYPEDEFD_TYPE)];
...
How do you go about properly deleting it? Technically, you would "delete [] pointerToTYPE", but given it's actually allocated as an array of unsigned chars, it doesn't feel correct to me. Simply doing "delete pointerToType" also doesn't feel right as there is possibly multiple elements of TYPEDEFD_TYPE in the allocation.
Would it be proper to say "delete [] (unsigned char*)pointerToTYPE"?
Of course I should just use malloc/free, that would simplify things a bit.
...
TYPEDEFD_TYPE * pointerToTYPE = (TYPEDEFD_TYPE*) new unsigned char[Multiple * sizeof(TYPEDEFD_TYPE)];
...
How do you go about properly deleting it? Technically, you would "delete [] pointerToTYPE", but given it's actually allocated as an array of unsigned chars, it doesn't feel correct to me. Simply doing "delete pointerToType" also doesn't feel right as there is possibly multiple elements of TYPEDEFD_TYPE in the allocation.
Would it be proper to say "delete [] (unsigned char*)pointerToTYPE"?
Of course I should just use malloc/free, that would simplify things a bit.