Re: type_info, vtable
Ivan Vecerina wrote:
[color=blue]
> | RTTI isn't need for exception handling, neither would it be
> | sufficient.
>
> I did not claim it was sufficient.
>
> But RTTI is needed to match catch handlers with exceptions.
> Consider:
>
> #include <vector>
> #include <string>
> #include <iostream>
> #include <exception>
> int main()
> {
> try {
> std::vector<std ::string> tooBig(1UL<<31, "just some string");
> }
> catch(std::exce ption& x) {
> std::cerr << "Failure: "<<x.what()<<st d::endl;
> }
> }
>
> How would the C++ run-time handle a failure of this memory allocation
> without RTTI?[/color]
I don't know. Maybe you should ask the gcc developers, since you can
disable RTTI and still use exceptions in g++.
Ivan Vecerina wrote:
[color=blue]
> | RTTI isn't need for exception handling, neither would it be
> | sufficient.
>
> I did not claim it was sufficient.
>
> But RTTI is needed to match catch handlers with exceptions.
> Consider:
>
> #include <vector>
> #include <string>
> #include <iostream>
> #include <exception>
> int main()
> {
> try {
> std::vector<std ::string> tooBig(1UL<<31, "just some string");
> }
> catch(std::exce ption& x) {
> std::cerr << "Failure: "<<x.what()<<st d::endl;
> }
> }
>
> How would the C++ run-time handle a failure of this memory allocation
> without RTTI?[/color]
I don't know. Maybe you should ask the gcc developers, since you can
disable RTTI and still use exceptions in g++.
Comment