Bjarne fix your freaking language
About 23 minutes into his talk about Safe C++ [1], Bjarne shows a slide with this code:void f(const char* p) // unsafe, naive use { FILE *f = fopen(p, “r”); // acquire // use f fclose(f); // release } He shows this code to demonstrate how easy it is to miss resource cleanup. Any code that exits the function inside // use f that doesn’t also call fclose results in a leak. He provides a C++ equivalent with RAII to avoid this footgun:class File_handle { // belongs in some support library FILE *p; public: File_handle(const char *pp, const char *r) { p = fopen(pp, r); if (p == 0) throw File_error(pp, r); } File_handle(const string& s, const char *r) { p = fopen(s.c_str(), r); if (p == 0) throw File_error(pp, r); } ~File_handle() { fclose(p); } // destructor // copy operations // access…