delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/28/06:42:44

Date: Tue, 28 Apr 1998 13:42:15 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Daniel Delorme <daniel AT coba DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: SIGFPE
In-Reply-To: <3.0.3.32.19980427165510.006a0c40@ns.coba.net>
Message-ID: <Pine.SUN.3.91.980428134153.27094H-100000@is>
MIME-Version: 1.0

On Mon, 27 Apr 1998, Daniel Delorme wrote:

> >runs fine for me...
> >first file:
> >#include "stdio.h"
> >double ReturnDouble(int I);
> >main()
> >{
> >[...]
> 
> Since you declare the function in the first file, it's no wonder the 
> program runs fine. It's as if the two functions are in the same file, 
> and I never had any trouble with that
> 
> Just try to remove "double ReturnDouble(int I);" from the first file :)

Why do you insist on writing buggy programs even *after* people here
have told you how to do it *right*?  Your problem was *exactly* that
you did NOT put the line with the prototype of `ReturnDouble' in the
file where it is called.  Without the prototype, the compiler assumes
that it returns an int, so you have your SIGFPE.  You *need* this
prototype, or else your program won't work.

As an aside, if you use the -Wall switch to gcc when compiling, it
complains about these cases.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019