[GD-Windows] VC 2005 Warning C4244
Brought to you by:
vexxed72
From: Dan G. <dan...@gm...> - 2007-12-12 12:21:46
|
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' |