From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13537 invoked by alias); 13 Oct 2002 16:34:56 -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 13530 invoked from network); 13 Oct 2002 16:34:55 -0000 Received: from unknown (HELO rwcrmhc51.attbi.com) (204.127.198.38) by sources.redhat.com with SMTP; 13 Oct 2002 16:34:55 -0000 Received: from stevedon ([66.31.245.176]) by rwcrmhc51.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with SMTP id <20021013163455.OMBR4193.rwcrmhc51.attbi.com@stevedon> for ; Sun, 13 Oct 2002 16:34:55 +0000 From: "Steve Dondley" To: Subject: RE: Avoiding "assignment from incompatible pointer type" warning Date: Sun, 13 Oct 2002 09:34:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal In-Reply-To: <000d01c272d5$85368b20$0100a8c0@windows9q3yn19> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-SW-Source: 2002-10/txt/msg00151.txt.bz2 Ah, OK. When I tried casting earlier, I was putting the cast on the lvalue. I don't have the world's sharpest tech mind but with persistence I'll get it eventually. > -----Original Message----- > From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]On > Behalf Of Joshua Nye > Sent: Sunday, October 13, 2002 12:28 PM > To: Steve Dondley; gcc-help@gcc.gnu.org > Subject: Re: Avoiding "assignment from incompatible pointer type" > warning > > > 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. > > > > > > >