Does catch(...)
catch all exceptions or will there be some exception that could be missed by this?
Asked
Active
Viewed 147 times
0
-
["The catch-all clause `catch (...)` matches exceptions of any type."](https://en.cppreference.com/w/cpp/language/try_catch) – Fred Larson Oct 28 '20 at 19:55
2 Answers
4
It will catch all C++ exceptions. There are other kinds of events named "exceptions". E.g. Windows has "structured exceptions", which may or may not be caught by it. There are also unrelated "floating-point exceptions".

Eugene
- 6,194
- 1
- 20
- 31
3
catch(...)
will catch any exception that can be thrown inside corresponding try
block.
See the reference page (3): https://en.cppreference.com/w/cpp/language/try_catch

αλεχολυτ
- 4,792
- 1
- 35
- 71
-
@veda Note that "exception" is a very broad term here. I.e. this will also catch `throw 5;`. – AVH Oct 28 '20 at 19:55