Date: Mon, 10 Jun 2002 08:13:10 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Richard Dawe cc: djgpp-workers AT delorie DOT com Subject: Re: Patches for building with gcc 3.1 - tests chunk In-Reply-To: <3D03BEF4.78F989@phekda.freeserve.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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. > 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.