Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3D04640C.98473EE9@phekda.freeserve.co.uk> Date: Mon, 10 Jun 2002 09:32:12 +0100 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: Patches for building with gcc 3.1 - tests chunk References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Eli Zaretskii wrote: > > On Sun, 9 Jun 2002, Richard Dawe wrote: > > > `-Wbad-function-cast (C only)' > > Warn whenever a function call is cast to a non-matching type. For > > example, warn if `int malloc()' is cast to `anything *'. > > > > So when we cast rand()'s return value to a double, we get an error. > > Are you saying that int and double do not match? They are both > arithmetic types, and the number of significant digits supported by a > double (about 17) is more than enough to represent all 32-bit integers. I didn't read the description properly - apologies. But removing -Wbad-function-cast does eliminate the warning. I agree with you now that this is a bug in gcc 3.1. > > Do we actually need to cast the return value? > > We need it to force the division to be done in floating point (as opposed > to two integers). But there are other ways of doing that, some of which > I mentioned in this thread several days ago. I've posted a new patch, using one of those methods. Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]