Sponsored Link •
Do all C++ applications need to perform overload of operators new and delete? Does failure to do so indicate a naïve presumption on the part of the programmer of goodness in the language facilities provided by your compiler?
In an early draft of the important new update to his eponymous Effective C++ - the 3rd Edition is due out in May! - Scott Meyers' said that "In my experience, almost all nontrivial C++ applications contain custom implementations of new and delete." He and I had one of our customary "heated debates" on this issue - mainly because I was concerned that, coming from Scott, it could be interpreted to mean that customising new and delete is a sine qua non of all sophisticated C++ development - the result of which was that we agreed to differ. (For a change <g>)
Not seeking to stir that particular pot again, I am nonetheless interested in finding out how well Scott's experience tallies with the wider experience of the C++ community. For my part, I've certainly had occasion to implement custom memory management schemes - both out of interest and out of necessity - but the necessity has only been in high-throughput financial/comms systems, and that's only amounted to around 10-20% of the projects I've worked on.
I'm also interested in whether, if this is indeed the general experience of C++ software developers, it might represent a rather damning appraisal of the memory managers that ship with most/all compilers. And if so, could this be construed to mean that there's something wrong with C++ per se, which we all know is patently false (albeit that it does contain the odd imperfection)? Alternatively, as Scott sagely observes, C++ is used in such a diverse array of application areas that compiler library implementors find themselves in something of an uncomfortable position: "if everybody is demanding in lots of different ways, they're not going to approach optimal for anybody, hence the need to customize".
Thanks in advance
|Matthew Wilson is a software development consultant and creator of the FastFormat, Pantheios and STLSoft libraries. He is author of the books Imperfect C++ (Addison-Wesley, October 2004) and Extended STL, volume 1 (Addison-Wesley, 2007), and is currently working on his third, Breaking Up The Monolith: Advanced C++ Design Without Compromise. He has published over 60 articles on C++ and other topics, and has served as columnist and contributing editor for C/C++ Users Journal. Matthew believes that code should be discoverable and largely self-documenting, and lives up to that by being a hopeless documentor. He can be contacted via http://www.imperfectcplusplus.com/ or firstname.lastname@example.org.|