From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11796 invoked by alias); 13 Oct 2002 16:28:26 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 11789 invoked from network); 13 Oct 2002 16:28:26 -0000 Received: from unknown (HELO lars.boxcarmedia.com) (209.213.0.162) by sources.redhat.com with SMTP; 13 Oct 2002 16:28:26 -0000 Received: from windows9q3yn19 (pool-151-203-145-112.wma.east.verizon.net [151.203.145.112]) by lars.boxcarmedia.com (Postfix) with SMTP id 70286122DC7; Sun, 13 Oct 2002 12:28:25 -0400 (EDT) Message-ID: <000d01c272d5$85368b20$0100a8c0@windows9q3yn19> From: "Joshua Nye" To: "Steve Dondley" , References: Subject: Re: Avoiding "assignment from incompatible pointer type" warning Date: Sun, 13 Oct 2002 09:28:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2002-10/txt/msg00150.txt.bz2 Hi Steve, What you're looking for is a cast. i.e.: int *p; float g = 3.141592653589793238; p = (int *)&g; --josh ----- Original Message ----- From: "Steve Dondley" To: Sent: Sunday, October 13, 2002 12:13 PM Subject: Avoiding "assignment from incompatible pointer type" warning > Hi, > > I've written a simple program that print out each bit of a floating point > variable so I can learn how floating point numbers are represented in > memory. The program contains the following statements: > > int *p; > float g = 2.0625; > p = &g; > > The third statement above generates an "assignment from incompatible pointer > type" warning for obvious reasons. Other than this, the program compiles > fine and works. > > My question is: Is there a way to properly assign a pointer of one type to > a variable of different type so that the warning is suppressed? > > Thanks again. > >