I would like to know whether the following statements are same or different
1> catch (domain_error const & x)
2> catch (const domain_error & x)
3> catch (domain_error & const x) // I think this is illegal
Basically, I thought case 1> and case 2> are same and case 3> is not legal syntax.
Please correct me if I am wrong.
You are correct; the first two are equivalent and the last one is an error.
More generally, when dealing with references, the syntaxes
and
are equivalent, while
is not allowed.