3 ms·
This is a very useful thing, and it's crucial that programmers learn it. And though it doesn't specifically say so in the article, this technique really needs
by makecheck 18y ago
This is a very useful thing, and it's crucial that programmers learn it.
And though it doesn't specifically say so in the article, this technique really needs to be applied everywhere in a C++ program and its libraries. Maybe your program doesn't throw exceptions, but something else might; if your cleanup isn't automatic, it may not always occur.
- tptacek 18y agoIt's also a really common code security problem in most C++ code written until ~2005 (meaning: most C++ code).
- benhoyt 18y agoI'm curious about this -- can you explain how it's a security problem, and why that changed ~2005?
- tptacek 18y agoThink of code executing say 30 stack frames in, generating an exception not caught until all the way up to 5 frames in (a very common situation). That exception cuts a swath through 25 functions, leaving stale variables and dangling pointers.