Java Exception vs C++ Exceptions

后端 未结 6 1344
一向
一向 2021-01-12 01:15

Where are exceptions stored ? Stack, Heap. How is memory allocated and deallocated for Exceptions? Now if you have more than one exception which needs to be handled are the

6条回答
  •  臣服心动
    2021-01-12 02:05

    For C++ it's not defined where to store exceptions, but most compilers use a special stack. For Java as somebody wrote before, they're stored on the heap.

    As exceptions are objects in C++ as well as in Java, they're allocated and deallocated as objects in the specific language.

    There is always only one exception active per thread in both languages.

提交回复
热议问题