3 ms·
There are a lot of large C++ shops that purposefully disable exceptions and yet still use RAII usefully. It's so useful that in many C codebases you see people
by kccqzy 2y ago
There are a lot of large C++ shops that purposefully disable exceptions and yet still use RAII usefully. It's so useful that in many C codebases you see people using RAII. For example Gtk has g_autoptr and g_autofree.
One of the most compelling things C++ offers to embedded use case is moving runtime initialization to compile-time initialization by liberally using constexpr functions. You literally ask the compiler to do work that would otherwise be done at runtime.
- tjoff 2y agoRAII is useful without exceptions yes. I guess it is the other way around. Exceptions are not useful without RAII (sorry not sorry most garbage collected languages ;)). But without exceptions it is mostly syntactic sugar anyway. If compile time initialization is the most compelling usecase I'll rest my case. Good feature, yes! Hardly worth switching language for.
- int_19h 2y agoIt's very useful syntactic sugar, though.