[ros-dev] Re: [ros-diffs] [arty] 13810: Some warning suppression. Read the<rant/>.

d_layer dome at koganet.ne.jp
Fri Mar 4 18:04:36 CET 2005


Hi,

Actually this is a designed behavior of -Wconversion and not a bug.
http://gcc.gnu.org/ml/gcc/2002-12/msg01431.html

-- 
d_layer

arty at svn.reactos.com wrote:
> + * <rant>
> + * These fix the following warning in GCC:
> + * warning: passing arg 1 of `ntohs' with different width due to
> prototype
> + *
> + * Even if you declare an unsigned char or unsigned short variable and
> pass
> + * it to htons or ntohs, this warning will be generated.  I believe
> this is
> + * a gcc bug.  You can try to reproduce the bug like this:
> + *
> + * u_short foo(u_short bar) {
> + *   return htons(bar);
> + * }
> + *
> + * Using the reactos compiler settings this generates the error.
> Unless I'm
> + * missing something, the active prototypes for htons and ntohs are:
> + *
> + * u_short PASCAL htons(u_short);
> + * u_short PASCAL ntohs(u_short);
> + *
> + * From winsock2.h.  Since the function above has exactly the same
> signature
> + * as htons except for the required PASCAL (__stdcall) decoration, gcc
> is
> + * erroneously detecting a narrowed value.
> + * </rant>



More information about the Ros-dev mailing list