[uClibc] Excepion handling doesn't work!
Federico Munerotto
mune at ieee.org
Sat Mar 20 21:44:25 UTC 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all.
In the uClibc toolchain I have:
./hello2
2
Aborted
while on GNU/Linux Debian 3.1 I have
./hello2
2
Caught a Divide by Zero exception
Aborted
The test program is simply:
======================================
#include <iostream>
#include <cstdlib>
#include <exception>
using namespace std;
int divide(int a, int b) {
~ if (b == 0) throw exception();
~ return a/b;
}
int main() {
~ int a = 5, b = 2;
~ int c = 6, d = 0;
~ try {
~ cout << divide(a,b) << endl; // 1) normal divide
~ cout << divide(c,d) << endl; // 2) Div by zero - caught in try
~ }
~ catch (...) {
~ cout << "Caught a Divide by Zero exception " << endl;
~ }
~ cout << divide(c,d) << endl; // 3) Div by zero - not caught
~ return 0;
}
======================================
In both cases compiled with
g++ -o hello2 hello2.cpp
This test shows that uClibc doesn't usa the catch branch, what can I do?
Thanks
- --
Fede
- -------------------------------------------------------------------------
~ mune at ieee.org Ing. Federico Munerotto
~ home http://www.krl.it/~mune
public key http://www.keyserver.net key ID C1ADA600
- -------------------------------------------------------------------------
There's nothing like a restart.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAXLs504XEGMGtpgARAg49AJ4iOkup/niCaL5HAnQdMV/ANN2b/ACfUhQg
wn6boDUa2fFippA+8Ihi7x8=
=lzXA
-----END PGP SIGNATURE-----
More information about the uClibc
mailing list