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>
&nbsp;<BR>
#pragma warning(disable : 4244)//double to float<BR><BR>enjoy<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
&gt; Date: Wed, 12 Dec 2007 21:56:34 +1000<BR>&gt; From: dan.glastonbury@gm=
ail.com<BR>&gt; To: [email protected]<BR>&gt; Subj=
ect: [GD-Windows] VC 2005 Warning C4244<BR>&gt; <BR>&gt; G'Day,<BR>&gt; I'm=
 trying to compile at warning level 4 and I'm getting a lot of<BR>&gt; spur=
ious C4244. This warning is about an integer narrow storing<BR>&gt; possibl=
y loosing information.<BR>&gt; <BR>&gt; The problem is with this kind of co=
de:<BR>&gt; <BR>&gt; u_short n =3D htons(x);<BR>&gt; <BR>&gt; htons returns=
 a u_short but, as the standard says, the result of<BR>&gt; integer express=
ions is promoted to int (or unsigned) and is causing<BR>&gt; the warning. I=
s there anyway I can code it to shut up VC 2005?<BR>&gt; <BR>&gt; u_short n=
 =3D (u_short)htons(x) doesn't work, because the result is<BR>&gt; still pr=
omoted in the context of an expression!<BR>&gt; <BR>&gt; cheers<BR>&gt; Dan=
G<BR>&gt; <BR>&gt; -- <BR>&gt; Dan Glastonbury, Dan dot Glastonbury at gmai=
l dot com<BR>&gt; `Pour encourjay lays ortras'<BR>&gt; <BR>&gt; -----------=
--------------------------------------------------------------<BR>&gt; SF.N=
et email is sponsored by:<BR>&gt; Check out the new SourceForge.net Marketp=
lace.<BR>&gt; It's the best place to buy or sell services for<BR>&gt; just =
about anything Open Source.<BR>&gt; http://sourceforge.net/services/buy/ind=
ex.php<BR>&gt; _______________________________________________<BR>&gt; Game=
devlists-windows mailing list<BR>&gt; [email protected]=
e.net<BR>&gt; https://lists.sourceforge.net/lists/listinfo/gamedevlists-win=
dows<BR>&gt; Archives:<BR>&gt; 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==--