delorie.com/archives/browse.cgi | search |
Date: | Fri, 31 May 2002 13:06:17 +0300 |
From: | "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> |
Sender: | halo1 AT zahav DOT net DOT il |
To: | djgpp-workers AT delorie DOT com |
Message-Id: | <7443-Fri31May2002130616+0300-eliz@is.elta.co.il> |
X-Mailer: | emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 |
In-reply-to: | <200205310919.LAA13003@lws256.lu.erisoft.se> (message from Martin |
Stromberg on Fri, 31 May 2002 11:19:07 +0200 (MET DST)) | |
Subject: | Re: Patches for building with gcc 3.1 - tests chunk |
References: | <200205310919 DOT LAA13003 AT lws256 DOT lu DOT erisoft DOT se> |
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 |
> From: Martin Stromberg <eplmst AT epl DOT ericsson DOT se> > Date: Fri, 31 May 2002 11:19:07 +0200 (MET DST) > > urand = ((double)rand()) / RAND_MAX; > > gives this warning: > > gcc @../../gcc.opt -I. -I- -I../../../include -pg -c signals.c > cc1.exe: warnings being treated as errors > signals.c: In function `int_handler': > signals.c:23: warning: cast does not match function type That's madness. Or a bug. > Evidently this option is for detecting "p = (sucker_t > *)malloc(sizeof(sucker_t));", which is nice and which I don't disagree > with. Same here. > But, surely this is another useless one. When did casting from int to > double become a non-matching type? It isn't. GCC is plain wrong here. > In this case we explicitly want to convert to double. How to do > that? Umm... Let's see... Perhaps we should cast it?! We can multiply by 1.0 to work around the problem. Or we could cast something that is not a function, like this: urand = rand() / (double)RAND_MAX; But it's a bug nonetheless. Someone (tm) should report it.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |