Mail Archives: djgpp/1996/02/29/07:17:00
Additional note on trapping exceptions with DJGPP v.2. / gcc 2.7.2
the bug is platform-dependent.. my executebles were tested on an older
'386 machine, without trouble ! Now I know that the '486 DX266 I use
to compile w DJGPP V.2 has 'something wrong' in it's memory management
since the same executable produces different results on different
machines ; this should not be of course if all PC were fully
compatible...
Conclusion :
on a 'reasonable pc' the following prog works w DJGPP v.2
-Emmanuel
--
Emmanuel BIGLER
courrier electronique bigler AT alpha DOT univ-fcomte DOT fr e-mail
telephone E.B. +33 81 66 69 54 E.B. phone
secretariat LPMO +33 81 66 69 99 LPMO secretary
telecopie +33 81 66 69 98 fax
Laboratoire de Physique et Metrologie des Oscillateurs
LPMO/CNRS, 32, avenue de l'observatoire
25044 Besancon Cedex, FRANCE
--------------------------------------------------
# exceptions and signal test program t.c
# for DJGPP v. 2 / DOS (gcc 2.7.2)
# compiled without optimization :
# gcc -s -o t t.c -lm
#
#include <stdio.h>
#include <signal.h>
#include <math.h>
void exception(int j)
{
printf("exception..!") ;
exit();
}
double one=1, zero=0;
main()
{
double res;
/* actually a combination of the following lines has worked on an
older '386 machine, but not on a particular '486 DX2 66 we have here,
causing an endless hanging of the prog not interruptible. Thus this
kind of prog should be tested on various PC's to see what happens. */
/*signal(SIGFPE, exception);*/
signal(SIGFPE, SIG_IGN);
/* raise(SIGFPE); */
res = one/zero;
res = log(zero);
return res=-1.0;
}
- Raw text -