It should been included from the begining

This commit is contained in:
Joud Kandeel
2026-03-05 05:38:32 +01:00
parent c5664cb732
commit 115c4fe32c

View File

@@ -0,0 +1,32 @@
#include <cstddef>
#include <cstdint>
#include <new>
// Delete corresponding to:
// void* operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line)
void __cdecl operator delete[](void* p, const char* name, int flags, unsigned debugFlags, const char* file, int line) noexcept {
delete[] static_cast<uint8_t*>(p);
}
// Delete corresponding to:
// void* operator new[](uint64_t size, uint64_t alignment, uint64_t offset, const char* pName, int flags, unsigned debugFlags, const char* file, int line)
void __cdecl operator delete[](void* p, unsigned __int64 size, unsigned __int64 alignment, unsigned __int64 offset, const char* pName, int flags, unsigned debugFlags, const char* file, int line) noexcept {
delete[] static_cast<uint8_t*>(p);
}
// You should also provide normal delete[] to match standard usage
void __cdecl operator delete[](void* p) noexcept {
if (p != nullptr) {
std::free(p);
p = nullptr;
}
}
void* __cdecl operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line) {
return new uint8_t[size];
}
void* __cdecl operator new[](unsigned __int64 size, unsigned __int64 alignment, unsigned __int64 offset, char const* pName, int flags, unsigned int debugFlags, char const* file, int line) {
return new uint8_t[size];
}