Re: [GD-Windows] VC 2005 Warning C4244
Brought to you by:
vexxed72
From: Jesus de S. G. <jes...@gm...> - 2007-12-13 00:01:23
|
Hmm... I am not having warnings in code like that with Visual Studio 2005 SP1 and W4... strange, isn't it? On Dec 12, 2007 12:56 PM, Dan Glastonbury <dan...@gm...> wrote: > 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 = htons(x); > > htons returns a u_short but, as the standard says, the result of > integer expressions is promoted to int (or unsigned) and is causing > the warning. Is there anyway I can code it to shut up VC 2005? > > u_short n = (u_short)htons(x) doesn't work, because the result is > still promoted in the context of an expression! > > cheers > DanG > > -- > Dan Glastonbury, Dan dot Glastonbury at gmail dot com > `Pour encourjay lays 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 about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > |