pool allocator changes and delete[] void*

Gabriel Dos Reis gdr@integrable-solutions.net
Sat Dec 27 17:02:00 GMT 2003


"Gawain Bolton" <gp.bolton@computer.org> writes:

| 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 is less maintainable about?

| What's the justification for such obfuscation?

I have exactly the opposite view:  The previous was incorrect and
obscure. 

| I'm also not convinced that the memory deallocation will correctly
| deallocate the memory allocated.

Because?

| It's not clear to me that operator
| new(size_t) and operator delete(void *) are inverse functions.

They are.  See 3.7.2 and 3.7.3

-- Gaby



More information about the Libstdc++ mailing list