Is using malloc for int undefined behavior until C++20
Is it true? Yes. Technically speaking, no part of: int *p = (int*)malloc(sizeof(int)); actually creates an object of type int, so dereferencing p is UB since there is no actual int there. Do we really have to call default constructor that is trivial to start the life time of the object? Do you have to … Read more