exceptiony
Alexandr Malusek
malusek na hroch.ujf.cas.cz
Pondělí Červen 1 15:48:15 CEST 1998
Tomas Vasko <vasko na pobox.sk> writes:
> #include <iostream.h>
>
> class Exception { protected: Exception(){}; };
> class ExcError : public Exception{};
>
> int main()
> {
> try{
> throw new ExcError();
> cout << "a" <<endl;
> }
> catch( Exception* )
> {
> cout << "Exception*" <<endl;
> }
> catch( ExcError* )
> {
> cout << "ExcError*" <<endl;
> }
> return 0;
> }
> --------
>
> by mal podla mna vypisat Exception a skoncit.
> vypisuje vsak ExcError!
$ g++ --version
2.7.2.3.f.1
$ g++ -fhandle-exceptions exc.cc -o exc
$ ./exc
ExcError*
$ /usr/local/egcs/bin/g++ --version
egcs-2.90.29 980515 (egcs-1.0.3 release)
$ /usr/local/egcs/bin/g++ -Wall exc.cc -o exc
$ ./exc
Exception*
Problem by tedy mel vyresit upgrade na egcs-1.0.3a, pripadne na jinou
novejsi verzi g++. Po pricinach jsem nepatral.
--
A. Malusek (malusek na ujf.cas.cz)
UJF AV CR
Další informace o konferenci Linux