Does allocating memory and then releasing constitute a side effect in a C++ program?

Viewed 618

Inspired by this question about whether the compiler can optimize away a call to a function without side effects. Suppose I have the following code:

delete[] new char[10];

It does nothing useful. But does it have a side effect? Is heap allocation immediately followed by a deallocation considered a side effect?

5 Answers
Related