Related to the program from 2004 that I'm fixing. The former developer used the following code to free 'len' elements of an array in the destructor:
unsigned int* _data;
...
if (_data) {
int len = size();
delete (unsigned int[len]) _data;
}
I can't compile this code with my compiler. The error message is:
error: ISO C++ forbids casting to an array type ‘unsigned int [(((unsigned int)(((int)l) + -0x00000000000000001)) + 1)]’</p>
There must be a reason he didn't use delete _data;
How should I fix this error?
Thanks.