deleting ‘void*’ is undefined [-Werror=delete-incomplete]
error: deleting ‘void*’ is undefined [-Werror=delete-incomplete]
今天做了一件这样的事
params_size = 2 * sizeof(void *) + sizeof(int *) + 2 * sizeof(int) + sizeof(int *) + 4 * sizeof(int);
cpu_params = new uint8_t[params_size];
delete[] cpu_params;
本来是为了打算避免频繁的申请内存,而统一一次申请内存,通过偏移使用。发现的释放的时候,报错。原来申请释放要统一,不能释放void*之类的
delete[] reinterpret_cast<uint8_t*>(cpu_params);
自己怎么申请怎么释放就好了。