From: joy merwin monteiro <joy.merwin@gmail.com>
To: Jagadeesh Bhaskar P <jbhaskar@hclinsys.com>
Cc: Manish Regmi <regmi.manish@gmail.com>,
Linux Newbie <linux-newbie@vger.kernel.org>
Subject: Re: Query on SIGFPE handling
Date: Mon, 22 Nov 2004 16:45:33 +0530 [thread overview]
Message-ID: <4b0d6e0d04112203153a163031@mail.gmail.com> (raw)
In-Reply-To: <1101111876.5382.8.camel@myLinux>
The basic mistake is that the variable values have not changed.
1/0 will generate a FPE no matter what you do.
use variables like a=0;b=1;
and if b/a generates an FPE,
change its value.(bit hazy how to implement this... google around)
the reason for giving you a signal handler
is obviously to help you correct the error,
not commit it over and over again!
reagrds,
Joy.M.Monteiro
PS: Such questions will be better answered on linux-cprogramming list....
try it.
On Mon, 22 Nov 2004 13:54:36 +0530, Jagadeesh Bhaskar P
<jbhaskar@hclinsys.com> wrote:
> Hi Manish,
>
> As suggested, I rewrote the C program using sigaction, as follows:
>
> /****** start of code **********/
>
> #include <stdio.h>
> #include <signal.h>
>
> void fe(int x){
> printf("floating pt exception:\n");
> }
>
> int main(void){
> struct sigaction p;
> p.sa_handler = fe;
> sigaction(SIGFPE, &p, NULL);
> printf("%f\n", (1/0));
> return 0;
> }
>
> /********* end of code *******/
>
> But then again the signal is being caught by the program infinitely. Why
> is that happening, if last time it was a problem with the signal()
> function.
>
> Please do help!!
>
>
>
> --
> With regards,
>
> Jagadeesh Bhaskar P
> R&D Engineer
> HCL Infosystems Ltd
> Pondicherry
> INDIA
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.linux-learn.org/faqs
>
--
people always turn away,
from the eyes of a stranger...
Afraid to know
what lies behind the stare.......
--QueensRyche
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2004-11-22 11:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-22 6:26 Query on SIGFPE handling Jagadeesh Bhaskar P
2004-11-22 7:00 ` Manish Regmi
2004-11-22 7:15 ` Jagadeesh Bhaskar P
2004-11-22 8:24 ` Jagadeesh Bhaskar P
[not found] ` <01ca01c4d071$5b35f080$121aa8c0@ascindia.com>
2004-11-22 9:05 ` Jagadeesh Bhaskar P
2004-11-22 9:19 ` Manish Regmi
2004-11-22 9:26 ` Jagadeesh Bhaskar P
2004-11-22 9:26 ` Manish Regmi
2004-11-22 11:15 ` joy merwin monteiro [this message]
[not found] ` <652016d3041122001540a047fd@mail.gmail.com>
[not found] ` <1101113860.5382.36.camel@myLinux>
2004-11-22 9:09 ` further query signal handling! Manish Regmi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4b0d6e0d04112203153a163031@mail.gmail.com \
--to=joy.merwin@gmail.com \
--cc=jbhaskar@hclinsys.com \
--cc=joy_mm@ieee.org \
--cc=linux-newbie@vger.kernel.org \
--cc=regmi.manish@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.