In what ways do C++ exceptions slow down code when there are no exceptions thown?

后端 未结 6 1848
终归单人心
终归单人心 2020-11-27 14:19

I have read that there is some overhead to using C++ exceptions for exception handling as opposed to, say, checking return values. I\'m only talking about overhead that is i

6条回答
  •  失恋的感觉
    2020-11-27 14:41

    Only overhead is ~6 instructions which add 2 SEH at the start of the function and leave them at the end. No matter how many try/catches you have in a thread it is always the same.

    Also what is this about local variables? I hear people always complaining about them when using try/catch. I don't get it, because the deconstructors would eventually be called anyways. Also you shouldn't be letting an exception go up more then 1-3 calls.

提交回复
热议问题