0

Does catch(...) catch all exceptions or will there be some exception that could be missed by this?

cigien
  • 57,834
  • 11
  • 73
  • 112
veda
  • 6,416
  • 15
  • 58
  • 78
  • ["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 Answers2

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