M
MaxMax
int *p;
p = new int[10];
void *q = (void*)p;
delete[] q;
Is this valid if p is guaranteed to be a POD? (don't ask why... there is a
reason I need this. Clearly I will create p in function, use p in another
function that know what type p is and delete p in a function that for
simplicity won't know what p is)
Reading the MSDN it seems that
"The global operator delete function, if declared, takes a single argument
of type void *, which contains a pointer to the object to deallocate. The
return type is void (operator delete cannot return a value). Two forms exist
for class-member operator delete functions:"
so it should be ok But this is the MSDN guide
--- bye
p = new int[10];
void *q = (void*)p;
delete[] q;
Is this valid if p is guaranteed to be a POD? (don't ask why... there is a
reason I need this. Clearly I will create p in function, use p in another
function that know what type p is and delete p in a function that for
simplicity won't know what p is)
Reading the MSDN it seems that
"The global operator delete function, if declared, takes a single argument
of type void *, which contains a pointer to the object to deallocate. The
return type is void (operator delete cannot return a value). Two forms exist
for class-member operator delete functions:"
so it should be ok But this is the MSDN guide
--- bye