In what way is ::operator new[]() different than ::operator new()?
<p>I need to construct an array of objects from a previously allocated block of memory. However, I cannot understand in what way <code>::operator new[]()</code> is different from <code>::operator new()</code> from the user point of view when allocating that block, since both require the size of the block. In the following example, using either one seems to have the same effect. Am I missing something?</p>

<pre><code>class J {
};

int main() {
    const int size = 5;

    {
        J* a = static_cast&lt;J*&gt; (::operator new[](sizeof (J) * size));
        for (int i = 0; i &lt; size; i++)
            new (&amp;a[i]) J();
        for (int i = 0; i &lt; size; i++)
            a[i].~J();
        ::operator delete[] (a);
    }

    {
        J* a = static_cast&lt;J*&gt; (::operator new(sizeof (J) * size));
        for (int i = 0; i &lt; size; i++)
            new (&amp;a[i]) J();
        for (int i = 0; i &lt; size; i++)
            a[i].~J();
        ::operator delete (a);
    }
}
</code></pre>
