Re: fexception handling in C
- From: "siliconwafer" <spdandavate@xxxxxxxxx>
- Date: 28 Jul 2005 00:28:31 -0700
Default User wrote:
> siliconwafer wrote:
>
> > Hi All,
> > I am using C on linux and performed a 1/0 operation i.e a divide by
> > zero using integer variables/constants.it gives me a floating point
> > exceptionand the program terminates.
> > I want to access the routine that causes this message to occour and
> > want to modify it so that my program continues to run.How is exception
> > handling done in C?Is there a try-catch equivalent?
> > Any help apriciated.
>
>
> Rather than try to handle the divide by 0, why not prevent it? You know
> where it's happening, add logic to test the operands and handle the
> situation.
>
>
>
> Brian
Hi Again,
Thanks for all your suggestions.I tried using signal() function.
It takes 2 args,a constant difining the type of signal and a function
pointer to signal handler.Can one pass more than one args to signal
handler?The signal function is defined as
void (*signal (int sig, void (*func)(int)))(int);
That is to say, signal is a function that returns a pointer to another
function. This second function takes a single int argument and returns
void. The second argument to signal is similarly a pointer to a
function returning void which takes an int argument.
Now signal() also returns a pointer to a function.But to which
function?Is it any user defined function or any C/system related
function?If so how can one use this return value?
some more help appriciated
Thanks,
-siliconwafer
.
- References:
- fexception handling in C
- From: siliconwafer
- Re: fexception handling in C
- From: Default User
- fexception handling in C
- Prev by Date: Re: Paasing global variables to functions
- Next by Date: Re: gcc 4 signed vs unsigned char
- Previous by thread: Re: fexception handling in C
- Next by thread: strange pointer behavior
- Index(es):
Relevant Pages
|