Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Aug 1998 09:41:28 +0000
From:      Mike Smith <mike@smith.net.au>
To:        Tim Borgeaud <Tim.Borgeaud@bristol.ac.uk>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Why is my code failing with SIGFPE? 
Message-ID:  <199808280941.JAA05495@word.smith.net.au>
In-Reply-To: Your message of "Fri, 28 Aug 1998 17:14:45 %2B0100." <199808281614.RAA27907@zeus.bris.ac.uk> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Apologies to all. I have managed to find the problem in my code.
>  
> I had missed out one of my include files. This had lead to a function being
> implicitly declared rather than declared as a function returning a double.
> 
> After browsing the mail archives and some careful attention to compiling
> I found the error. I forget who wrote the message that described this function
> misdeclaration as a cause of SIGFPE. Thanks to whoever it was.
> 
> Is this kind of behaviour from the compiler unavoidable? It took me ages to
> track down the bloody problem. As a novice programmer I was confused by the
> floating point exception and spent a long time wondering how my variables could
> have gone out of range.

It's a lesson: always study the compiler output.

If you're just starting out, make sure you add '-ansi -Wall -Werror' to 
your compiler flags.  This'll get you playing more attention to it. 8)

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808280941.JAA05495>