home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!caen!mslyz
- From: mslyz@congeries.engin.umich.edu (Marko J Slyz )
- Subject: signal.h help
- Message-ID: <#fV=v+B@engin.umich.edu>
- Date: Sat, 19 Dec 92 01:47:56 EST
- Organization: University of Michigan Engineering, Ann Arbor
- Originator: mslyz@congeries.engin.umich.edu
- Nntp-Posting-Host: congeries.engin.umich.edu
- Lines: 42
-
-
- The following program was written for an HP9000/700 and compiled
- with: c89 -ot1 t1.c -lm
-
- It compiles with no errors or warnings.
- -----------------------------------------------------
- #include <stdio.h>
- #include <signal.h>
-
- extern int errno;
-
- main()
- {
- double x,y;
-
- y = 0.0; /* sic */
-
- if (signal(SIGFPE,SIG_IGN) == SIG_ERR)
- printf("couldn't set up new signal handler\n");
-
- x = 100.0/y;
-
- printf("x = %.15g\n", x);
- printf("(char)x = %d\n",(char)x);
- }
-
- -----------------------------------------------------
-
- When run as shown above it prints
- x = ++
-
- and then hangs. ^C will recover (but not just a CR). If you
- leave out the "if" statement it says
-
- x = ++
- Floating exception (core dumped)
-
- I've tried writing my own error handler and that doesn't help.
- Any ideas?
-
- Thanks in advance,
- Marko
-