This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -Wconversion bug in g++-4.3?
- From: Andrew Haley <aph at redhat dot com>
- To: "Manuel López-Ibáñez" <lopezibanez at gmail dot com>
- Cc: "Tom Browder" <tom dot browder at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Fri, 23 Nov 2007 10:13:00 +0000
- Subject: Re: -Wconversion bug in g++-4.3?
- References: <8bc817ee0711220633t68c7f078udc507d902830860@mail.gmail.com> <6c33472e0711220846s207f65c3o333d87a350a8f2fa@mail.gmail.com> <6c33472e0711221502q54e9288ey7c30c9c96d3f72a1@mail.gmail.com>
Manuel López-Ibáñez writes:
> For this testcase:
>
> void g(const unsigned char b)
> {
> unsigned short c = b & 0xff;
> }
>
> we get:
>
> wconversion-3.c:3: warning: conversion to 'unsigned char' from 'int'
> may alter its value
> wconversion-3.c:3: warning: conversion to 'short unsigned int' from
> 'int' may alter its value
>
> Really weird... It is the same in both C and C++.
Please read http://gcc.gnu.org/wiki/NewWconversion. Please come back
if you have any further questions.
Andrew.
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903