Reputation: 6546
there are 3 types of exception:
(1) pointer
catch(exception* e){
}
(2) copy
catch(exception e){
}
(3) reference
catch(exception& e){
}
but what's the meaning for
catch(exception){
}
it it equal with (2) without no any difference in c++?
Upvotes: 0
Views: 257
Reputation: 42588
In C++, it is possible to have a parameter without a variable name.
You should be able to have all of the following:
catch (std::exception* e) {}
catch (std::exception*) {}
catch (std::exception& e) {}
catch (std::exception&) {}
catch (std::exception e) {}
catch (std::exception) {}
A parameter without a variable name is a signal to the compiler that a parameter is required, but the value is unused in the method.
Upvotes: 4