Message-ID: <3AF8E00F.CA9586AF@falconsoft.be> Date: Wed, 09 May 2001 08:13:35 +0200 From: Tim Van Holder Organization: Falcon Software NV X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.16-3 i686) X-Accept-Language: en, nl-BE, nl MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Bug in gcc or in my install ? References: <20010508123935 DOT 685 DOT qmail AT web6304 DOT mail DOT yahoo DOT com> <9d8reh$pes$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 30 NNTP-Posting-Host: 194.78.64.238 X-Trace: 989388812 reader0.news.skynet.be 3121 194.78.64.238 X-Complaints-To: abuse AT skynet DOT be To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hans-Bernhard Broeker wrote: > > Florent Georges wrote: > > > In a first time, I prefer to think that it's a bug in my install, > > instead in gcc, but it's quite strange. > > Neither of these. It's a usage error. > > The function you're using, nextafterf(), is not in the ANSI > standardized subset of library functions, and thus its declaration is > turned invisible in gcc -ansi mode. Adding -O2 -Wall flags to your > compile line would have given you a hint in that direction, warning > about an "implicit declaration of function `nextafterf'". > > I.e.: this program of yours cannot be compiled by a strict ANSI C > compiler like 'gcc -ansi'. Actually, it can be - he DID compile and link it. The problem is that the compiler never saw the prototype, so it assumes all arguments are ints and therefore it will cast everything you pass to it to int, which is definitely not what you want. If you add a prototype for nextafterf to your .c file, I expect it will behave correctly whether you use -ansi or not. -- Tim Van Holder - Falcon Software N.V. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This message was posted using plain text. I do not endorse any products or services that may be hyperlinked to this message.