3 ms·
Exceptions have a setup cost. You pay that setup cost every time an exception frame is created.
by fredsanford 7y ago
Exceptions have a setup cost. You pay that setup cost every time an exception frame is created.
- plorkyeran 7y agoThat is not true on most platforms in use today. The Itanium ABI uses "zero cost" exceptions which do not have any setup or runtime cost when an exception is not thrown (at the cost of making throwing exceptions much more expensive than other schemes). 64-bit Windows and arm64 use similar schemes.
- fredsanford 7y agoI guess I have to use weasel words in every post now. Let's pretend my previous post started with "In most cases, "
- Dylan16807 7y agoBut that's the point, it's not most. GCC and Clang default to zero-cost DWARF. Add Windows and Arm64 and that's almost everything.
- jcelerier 7y agoThe only "relevant" platform where exceptions aren't zero cost nowadays is 32-bit windows - not even 64-bit one. so no, absolutely not "in most cases".