From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4615 invoked by alias); 27 Feb 2002 19:07:15 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 4471 invoked from network); 27 Feb 2002 19:07:04 -0000 Received: from unknown (HELO monkey.daikokuya.demon.co.uk) (158.152.184.26) by sources.redhat.com with SMTP; 27 Feb 2002 19:07:04 -0000 Received: from neil by monkey.daikokuya.demon.co.uk with local (Exim 3.34 #1 (Debian)) id 16g9Pn-0007tZ-00; Wed, 27 Feb 2002 19:06:59 +0000 Date: Wed, 27 Feb 2002 11:14:00 -0000 To: "Ralf W. Grosse-Kunstleve" Cc: gcc@gcc.gnu.org, rwgk@boa.lbl.gov Subject: Re: warning: assignment to `int' from `double' Message-ID: <20020227190659.GB30162@daikokuya.demon.co.uk> References: <200202271824.g1RIOsc53303@boa.lbl.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200202271824.g1RIOsc53303@boa.lbl.gov> User-Agent: Mutt/1.3.27i From: Neil Booth X-SW-Source: 2002-02/txt/msg01682.txt.bz2 Ralf W. Grosse-Kunstleve wrote:- > The following code generates warnings with gcc 3.0.3: > > int main() > { > int i; > double d; > i = 0; > i += d; > return 0; > } > > g++ -g z.cpp -o z > > z.cpp: In function `int main()': > z.cpp:6: warning: assignment to `int' from `double' > z.cpp:6: warning: argument to `int' from `double' > > Is it possible to suppress this warning without resorting to -w? Have you tried a cast? Neil.