Why do we even need the "delete[]" operator?
<p>This is a question that's been nagging me for some time.  I always thought that C++ should have been designed so that the "delete" operator (without brackets) works even with the "new[]" operator.</p>

<p>In my opinion, writing this:</p>

<pre><code>int* p = new int;
</code></pre>

<p>should be equivalent to allocating an array of 1 element:</p>

<pre><code>int* p = new int[1];
</code></pre>

<p>If this was true, the "delete" operator could always be deleting arrays, and we wouldn't need the "delete[]" operator.</p>

<p>Is there any reason why the "delete[]" operator was introduced in C++?  The only reason I can think of is that allocating arrays has a small memory footprint (you have to store the array size somewhere), so that distinguishing "delete" vs "delete[]" was a small memory optimization.</p>
