Exceptions
The C++ exception system is similar to Java's, especially in syntax. Exceptions in a try block are caught by the associated catch blocks. Some differences from Java:
  1. C++ uses exceptions much more sparingly than Java. The standard libraries rarely throw exceptions.
  2. The C++ standard libraries throw types derived from std::exception.
  3. The language itself allows any type which can be copied to be thrown (throw needs to copy the object).
  4. C++ has a universal catch that can catch any thrown type.
    catch(...)
    Yes, the dots are part of the syntax.
  5. Throwing a new object Java-style pretty much never makes sense. In C++,
    throw runtime_error("Something Went Wrong");
    not the Java-style
    throw new RuntimeException("This Was Not Supposed To Happen");
  6. Catching is usually by reference.
    catch(exception &e);
  7. Exceptions do not convert to string, but the standard ones have a what() method instead.
  8. A function may be marked noexcept
    void f() noexcept { /* Do Something */ }
    which just means that, at run-time, any attempt to throw from f terminates the program.