I come to C and C++ from Assembly before 2.5 decades.
I inherited some things implied in assembly, to both C and C++, but later I realized that these things are actually undefined behavior.
One of these was the difference between delete ptr
and delete[] array
which for OS is usually one call because there are no destructors.
My latest assumption is the following code:
std::byte *a = new std::byte[10];
short *b = reinterpret_cast<std::byte*>(a);
delete[] b;
Is this undefined behavior? There are no destructors at all.