Re: VC 2005 Warning C4244
Jeff Gooloolie <[email protected]> Thu, 13 Dec 2007 13:51:09 -0700
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <[email protected]> |
--===============0512832039== Content-Type: multipart/alternative; boundary="_25fc4d15-c7ed-463e-9d87-c52967bde072_" --_25fc4d15-c7ed-463e-9d87-c52967bde072_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable You can disable the warning using a #pragma: =20 #pragma warning(disable : 4244)//double to floatenjoy =20 =20 =20 > Date: Wed, 12 Dec 2007 21:56:34 +1000> From: [email protected]> T= o: [email protected]> Subject: [GD-Windows] VC 200= 5 Warning C4244> > G'Day,> I'm trying to compile at warning level 4 and I'm= getting a lot of> spurious C4244. This warning is about an integer narrow = storing> possibly loosing information.> > The problem is with this kind of = code:> > u_short n =3D htons(x);> > htons returns a u_short but, as the sta= ndard says, the result of> integer expressions is promoted to int (or unsig= ned) and is causing> the warning. Is there anyway I can code it to shut up = VC 2005?> > u_short n =3D (u_short)htons(x) doesn't work, because the resul= t is> still promoted in the context of an expression!> > cheers> DanG> > --= > Dan Glastonbury, Dan dot Glastonbury at gmail dot com> `Pour encourjay l= ays ortras'> > ------------------------------------------------------------= -------------> SF.Net email is sponsored by:> Check out the new SourceForge= .net Marketplace.> It's the best place to buy or sell services for> just ab= out anything Open Source.> http://sourceforge.net/services/buy/index.php> _= ______________________________________________> Gamedevlists-windows mailin= g list> [email protected]> https://lists.sourcefor= ge.net/lists/listinfo/gamedevlists-windows> Archives:> http://sourceforge.n= et/mailarchive/forum.php?forum_id=3D555 _________________________________________________________________ Get the power of Windows + Web with the new Windows Live. http://www.windowslive.com?ocid=3DTXT_TAGHM_Wave2_powerofwindows_122007= --_25fc4d15-c7ed-463e-9d87-c52967bde072_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <html> <head> <style> .hmmessage P { margin:0px; padding:0px } body.hmmessage { FONT-SIZE: 10pt; FONT-FAMILY:Tahoma } </style> </head> <body class=3D'hmmessage'> You can disable the warning using a #pragma:<BR> <BR> #pragma warning(disable : 4244)//double to float<BR><BR>enjoy<BR> <BR> <BR> <BR> > Date: Wed, 12 Dec 2007 21:56:34 +1000<BR>> From: dan.glastonbury@gm= ail.com<BR>> To: [email protected]<BR>> Subj= ect: [GD-Windows] VC 2005 Warning C4244<BR>> <BR>> G'Day,<BR>> I'm= trying to compile at warning level 4 and I'm getting a lot of<BR>> spur= ious C4244. This warning is about an integer narrow storing<BR>> possibl= y loosing information.<BR>> <BR>> The problem is with this kind of co= de:<BR>> <BR>> u_short n =3D htons(x);<BR>> <BR>> htons returns= a u_short but, as the standard says, the result of<BR>> integer express= ions is promoted to int (or unsigned) and is causing<BR>> the warning. I= s there anyway I can code it to shut up VC 2005?<BR>> <BR>> u_short n= =3D (u_short)htons(x) doesn't work, because the result is<BR>> still pr= omoted in the context of an expression!<BR>> <BR>> cheers<BR>> Dan= G<BR>> <BR>> -- <BR>> Dan Glastonbury, Dan dot Glastonbury at gmai= l dot com<BR>> `Pour encourjay lays ortras'<BR>> <BR>> -----------= --------------------------------------------------------------<BR>> SF.N= et email is sponsored by:<BR>> Check out the new SourceForge.net Marketp= lace.<BR>> It's the best place to buy or sell services for<BR>> just = about anything Open Source.<BR>> http://sourceforge.net/services/buy/ind= ex.php<BR>> _______________________________________________<BR>> Game= devlists-windows mailing list<BR>> [email protected]= e.net<BR>> https://lists.sourceforge.net/lists/listinfo/gamedevlists-win= dows<BR>> Archives:<BR>> http://sourceforge.net/mailarchive/forum.php= ?forum_id=3D555<BR><BR><br /><hr />Get the power of Windows + Web with the = new Windows Live. <a href=3D'http://www.windowslive.com?ocid=3DTXT_TAGHM_Wa= ve2_powerofwindows_122007' target=3D'_new'>Get it now!</a></body> </html>= --_25fc4d15-c7ed-463e-9d87-c52967bde072_-- --===============0512832039== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace --===============0512832039== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Gamedevlists-windows mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555 --===============0512832039==--