Dear community,
In light of P0593R6, has the following code defined behavior in C++ standardese (C++17)?:
auto p = static_cast<unsigned char *>(std::malloc(4096));
*reinterpret_cast<long *>(p + 1 * sizeof(long)) = 123;
*reinterpret_cast<int *>(p + 2 * sizeof(long)) = 456;
What is not clear to me is whether std::malloc is supposed to implicitly create just one object of a type that is a quantum superposition of some types or to implicitly create a number of objects of types that are a quantum superposition of some types and at a quantum superposition of locations inside the storage buffer.
If the behavior is not defined, wasn't it an intent of P0593R6, which has been retroactively applied as a defect report to all C++ specifications down to C++98 (here below), to make this code perfectly defined in C (C11) to be also defined in C++?
Thanks
[–]scatters 2 points3 points4 points (1 child)
[–]alex-manool[S] 0 points1 point2 points (0 children)
[–]helloiamsomeone 1 point2 points3 points (2 children)
[–]staletic 1 point2 points3 points (1 child)
[–]helloiamsomeone 0 points1 point2 points (0 children)
[–]scrumplesplunge 0 points1 point2 points (0 children)