VC 2005 Warning C4244
"Dan Glastonbury" <[email protected]> Wed, 12 Dec 2007 21:56:34 +1000
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <[email protected]> |
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 [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555