On Sat, Aug 12, 2017 at 1:27 AM, Michael Zimmermann sigmaepsilon92@gmail.com wrote:
That also depends on what you want to use C++ for. If you just want to use the convenient syntax and language features then you don't need to link against any additional library. In that case you'd disable exceptions and rtti and implement new/delete using malloc/free.
Instead of pounding a round peg into a square hole with C++, maybe the path to pursue is GCC support for try/finally in C. You get most of the semantics you are looking for, and someone as experienced as you will know exactly what to do with the feature.
Lack of try/finally support means library often do awful things. Asterisk was full of issues, like resource leaks, that try/finally would have fixed. Eventually Asterisk moved to nested/inner functions and trampolines. They silently lost NX stacks, which was a cure as bad as the disease. It just moved problems around rather than fixing them.
Microsoft compilers support try/finally in C. I recall a GCC bug report years ago asking for it, but it was declined.
Jeff