pool allocator changes and delete[] void*

Nathan Myers ncm-nospam@cantrip.org
Sat Dec 27 17:18:00 GMT 2003


On Sat, Dec 27, 2003 at 02:22:43PM +0100, Gawain Bolton wrote:
> I'm not understanding something here.  Why replace "new char[n]" with
> "static_cast<char *>(::operator new(n))"?  It seems to me this is less
> readable, less obvious and therefore less maintainable.  What's the
> justification for such obfuscation?

"new char[n]" is not required to be aligned for anything but char.
"operator new(n)" is required to have alignment suitable for any type.

Nathan Myers
ncm-nospam@cantrip.org



More information about the Libstdc++ mailing list