3 ms·
UB can do anything, including something that seems like it works. Just because the memory has been deallocated doesn't mean that the bytes there were changed.
by steveklabnik 6y ago
UB can do anything, including something that seems like it works.
Just because the memory has been deallocated doesn't mean that the bytes there were changed. The pointer may still point to them, and it may still "work."