www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/06/18:14:10

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Turning off warnings using #pragma, is it possible?
Date: Sun, 06 Apr 1997 04:00:22 -0700
Organization: Two pounds of chaos and a pinch of salt
Lines: 35
Message-ID: <33478246.3E95@cs.com>
References: <5i90b5$fla AT nr1 DOT toronto DOT istar DOT net>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp223.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jeff Weeks wrote:
> 
> for(i = 0; i < 256; i++) {
>   sine[i] = sin(i*2*3.1415926/256.0)*256;
>   cosine[i] = cos(i*2*3.1415926/256.0)*256;
> }
> 
> In other words, it's calculating the sin/cos values and putting them
> into a 24.8 fixed math int.  But, ofcourse, DJGPP complains about
> converting a double to an int... but if I typecast to an int with
> 
> sine[i] = (int)...
> 
> It does calculate the sine/cosine tables right (they all seem to be 0).
> So I'd like to turn off warnings for this little block.  Is it possible?

Try putting the whole thing in parentheses, like so:

sine[i] = (int) ( sin( i * 2 * M_PI / 256.0 ) * 256 );

> 
> If not, what's the command line switch to disable this warning globally?

I'm not sure, but you can probably find it by looking in the gcc
documentation ("info gcc invoking warning").

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---)
O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++
e(*)>++++ h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019