3 ms·
Is this refuting a claim that is actually made? Do people claim exceptions never have overhead on the happy path in C++? As an analogy, forget exceptions for a
by dataflow 4y ago
Is this refuting a claim that is actually made? Do people claim exceptions never have overhead on the happy path in C++?
As an analogy, forget exceptions for a moment—just imagine plain function calls in C++ vs. Python. In Python, function calls always have overhead. In C++, though, we say function calls don't add overhead, because function calls can be inlined. But when we make that claim, we obviously don't mean function calls never have overhead in C++—obviously, the statement can't apply if you can't inline the call. Rather, the meaning of the claim is that function calls don't inherently introduce overhead—i.e. if they do, it's because of some other fact (like inability to inline), not the mere existence of the function call itself.
The case seems similar to me here. When people say exceptions don't slow down the happy path, they don't mean this is impossible. They just mean that if this does occur, it's due to additional inherent obstacles beyond the mere enablement of exceptions (e.g., opaque function calls).
- deleted 4y ago[deleted]
- pjc50 4y ago"Zero-cost exceptions aren’t actually zero cost" : https://devblogs.microsoft.com/oldnewthing/20220228-00/?p=106296 https://devblogs.microsoft.com/oldnewthing/20220228-00/?p=10...