Tags » RAII

RAII with C libraries: Follow-up

Last week, I talked about the custom deleter feature built into std::unique_pointer, and how we can leverage that to easily add RAII-support to C-libraries. 1,056 more words

C++

A technique for using automatic memory management (RAII) with C libraries

UPDATE: I’ve written a follow-up post on how to implement the idea presented in this post in a simpler and more flexible way. If you’re thinking about using this technique, I’d encourage you to also read the follow-up. 1,522 more words

C++

foonathan::blog() - How to handle errors in constructors without exceptions?

Sometimes you need to write code that can’t use exceptions. If that’s the case there isn’t an obvious way to handle errors in constructors, as they don’t have a return value. 29 more words

C++

Reboot Early, and Often!

A wise man once said to me “Reboot early, and often!” He said it many times actually. When you’re trying to troubleshoot programs for which you don’t have the source code, you tend to develop little rituals that you go through to “fix” them… 297 more words

Programming