Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谈论一般的垃圾收集语言:
当调用堆栈越深抛出异常时,cpu 周期的性能会降低吗?
因此,如果在捕获它的同一个函数中抛出异常,它基本上会是一个 goto 吗?
如果在捕获它的同一个函数中抛出异常,它基本上是一个 goto 吗?
不,许多其他事情,包括构造 a StackTraceElement[],都是在创建异常时完成的。从理论上讲,您可以抛出一个先前存在的异常来避免这种构造,但显然这会破坏首先抛出异常的大部分目的。
StackTraceElement[]