Lionello Lunesu wrote:
My point was that realloc() is wrong, not free(). The sorely missing allocation primitive is expand(), and we've been paying for it through the nose for decades.

Andrei

What would expand's signature be? It needs the current pointer, it needs the new size. Seems that it's nothing else than a renamed realloc.

realloc moves memory, expand wouldn't. That delivered a fatal blow to C++ making its allocation primitives inferior to C's.

The problem is just that realloc allows null-pointer (=malloc) and 0-size (=free), thereby making malloc/free obsolete.

That's the least of its problems.

Andrei

Reply via email to