question regarding new warning
Andrew Haley
aph@redhat.com
Thu Mar 27 07:45:00 GMT 2014
Hi,
On 03/26/2014 03:05 PM, Daniel Gutson wrote:
> assigning a negative literal to an unsigned variable issues no warning:
>
>
> unsigned int x;
> x =- 4;
>
> This is specially important in typos when -= was intended instead of =-
>
> Would be acceptable if I add a new warning to handle this, i.e.
> -Wnegative-to-unsigned
> or alike?
Assigning a negative literal to an unsigned variable is well-defined
standard C. Is it really appropriate to warn for correct code?
Andrew.
More information about the Gcc
mailing list