re: GCC Differences

2002-06-14 Thread Greg Freemyer
Chris, As all have said, your missing the return. Another mistake in my opinion is using == with floats. You cannot depend on that to work. This is just the nature of floating point numbers. In your case b is probably 20.01 or something like it. The printf is showing 20.00 b

Re: GCC Differences

2002-06-14 Thread Chris Rode
On 14 Jun 2002, Guillaume Cottenceau wrote: > Chris Rode <[EMAIL PROTECTED]> writes: > > [...] > > > float toot(int x, float y) { > >if (y == 20) { > > return y; > >} else { > > toot(x, x*y); (**) > >} > > } > > > > > > Compiled with Red Hat's gcc 2.96, I

re: GCC Differences

2002-06-14 Thread Greg Freemyer
Chris, As all have said, your missing the return. Another mistake in my opinion is using == with floats. You cannot depend on that to work. This is just the nature of floating point numbers. In your case b is probably 20.01 or something like it. The printf is showing 20.00 b

Re: GCC Differences

2002-06-14 Thread James Olin Oden
> > float toot(int x, float y) { >if (y == 20) { > return y; >} else { > toot(x, x*y); >} > } The code itself is broken as other have said you need: return(toot(x, x*y)); The reason it ever did work has to do with the internal mechanics of how function calls are

Re: GCC Differences

2002-06-14 Thread Guillaume Cottenceau
Chris Rode <[EMAIL PROTECTED]> writes: [...] > float toot(int x, float y) { >if (y == 20) { > return y; >} else { > toot(x, x*y); (**) >} > } > > > Compiled with Red Hat's gcc 2.96, I get "nan" (however, If I take out > the recursive call, and just return

Re: GCC Differences

2002-06-14 Thread John Summerfield
> I'm honestly not trying to resurrect some gcc 2.96 flame war or anything > here, but I'm not a very seasoned C programmer, and I've run across an > inconsistancy between Red Hat's version of gcc, and gcc 2.95.4 on a Debian > system. Consider the following uninspired, pointless piece of code:

Re: GCC Differences

2002-06-14 Thread Raymond Fung
Dear Chris, Your recurse statment should read : return (toot (x, x * y)); instead of just : toot (x, x * y); Regards, Raymond Chris Rode wrote: > I'm honestly not trying to resurrect some gcc 2.96 flame war or anything > here, but I'm not a very seasoned C programmer, and I've run

GCC Differences

2002-06-13 Thread Chris Rode
I'm honestly not trying to resurrect some gcc 2.96 flame war or anything here, but I'm not a very seasoned C programmer, and I've run across an inconsistancy between Red Hat's version of gcc, and gcc 2.95.4 on a Debian system. Consider the following uninspired, pointless piece of code: #inclu