Reputation: 1
I have used stack overflow countless times, but in my quest to teach myself c++, I find it's time to sign up and be part of the community. My question is about chapter 5 in Bjarne Stroustrup's Principles and Practices using c++. The book examples, along with the lecture slides I've found online, show the error handling as follows...
if (a <= 0 || b <= 0)
{
error("bad values");
}
cout << "the area is " << area(a, b)<<'\n';
I have done lots of research, thinking maybe it's a syntax thing that has changed in VS 15 or maybe its something wrong with the header file the book has us create. The error message I get is...
Unhandled exception at 0x74E5C42D in ConsoleApplication5.exe: Microsoft C++ exception: std::runtime_error at memory location 0x002CF5E4.
Any help would be hugely appreciated.
Upvotes: 0
Views: 94
Reputation: 409166
std::runtime_error
is a standard exception (see this error handling reference for more standard exceptions). My guess without seeing the error
function is that it throws the std::runtime_error
exception.
In other words, it's nothing specific to VS2015 or C++ in general, it's simply how error handling was designed for the examples in the book.
Upvotes: 2