Originally Posted by
Lindley
Not entirely true. That's certainly the philosophy of C; but C++ has embraced a policy emphasizing safety from the start, and enhancements like the STL only take things further in that direction. Lots of stuff is kept "under the hood" to make your code safer.
That said, the reason why is fairly simple: The delete operator takes a pointer by value. Just like any pointer passed by value, the function can modify what it points to (in this case, an allocated memory block), but it cannot modify the pointer itself in any way visible to the caller.
Could the language have been written so that delete took the pointer by reference instead? Yeah, probably. But there were reasons why that seemed like a bad idea, I'm sure.
The safest policy is to design your code so that you never have to call delete. I'm not endorsing memory leaks; but usage of STL containers can reduce most of your need to call "new", and usage of smart pointers can remove your need to explicitly call delete even when you do call new. Together, STL containers and smart pointers will make your code infinitely easier to maintain.