Call-stack for exceptions in C++

后端 未结 10 1386
忘了有多久
忘了有多久 2020-12-14 15:33

Today, in my C++ multi-platform code, I have a try-catch around every function. In every catch block I add the current function\'s name to the exception and throw it again,

10条回答
  •  执念已碎
    2020-12-14 15:45

    The answer to all your problems is a good debugger, usually http://www.gnu.org/software/gdb/ on linux or Visual Studio on Windows. They can give you stack traces on demand at any point in the program.

    Your current method is a real performance and maintenance headache. Debuggers are invented to accomplish your goal, but without the overhead.

提交回复
热议问题