3 ms·
> Is "writing truly exception-safe" something that necessary? If you want your connections cleanly terminated, your temporary files removed, and your database
by humanrebar 9y ago
> Is "writing truly exception-safe" something that necessary?
If you want your connections cleanly terminated, your temporary files removed, and your database transactions invalidated, yes.
- jcelerier 9y ago> If you want your connections cleanly terminated, your temporary files removed, and your database transactions invalidated, yes. sure, and if you develop in C++ and put these in RAII classes they will be automatically.
- humanrebar 9y agoBecause they're exception safe. But it's also possible to use them in an exception unsafe way.
- jcelerier 9y agowell, that's what I don't understand with OP's > Considering how hard it is to write truly exception-safe C++ that's the default behaviour in C++ code, how hard can it be ?
- yongjik 9y agoException safety is hardly a "default behavior" of C++, considering such gems[1] as: // This is unsafe. sink( unique_ptr<widget>{new widget{}}, unique_ptr<gadget>{new gadget{}} ); // This is safe. sink( make_unique<widget>(), make_unique<gadget>() ); [1] https://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/ https://herbsutter.com/2013/05/29/gotw-89-solution-smart-poi...
- pubby 9y agoThe default nowadays is basic exception safety, where nothing leaks but objects can get put in invalid states. Strong exception safety (rollback semantics) is still pretty hard.
- colanderman 9y agoI'm pretty sure that's what is meant by "truly exception-safe".