Hacker News new | ask | show | jobs
by WizzleKake 4072 days ago
Why not just put a and b on the stack then? ;)

Bjarne says, "Code that creates an object using new and then deletes it at the end of the same scope is ugly, error-prone, and inefficient."

1 comments

Because it's an example of allocating things on the heap. You could also say the same about the "good" RAII version shown - but then there wouldn't be much point to the article, would there?