[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is this OK in C++ and C?



* Zbigniew Komarnicki:

> Is this OK or is this a bug, when the wariable 'n' is
> initializing by negative value? There no any warning.
> Is this normal? I know that value -5 is converted
> to unsigned but probably this should by printed a warning,
> when this is a constant value. What do you think about this?

$ g++ -Wsign-conversion t.cc
t.cc: In function ‘int main()’:
t.cc:7:25: warning: negative integer implicitly converted to unsigned type [-Wsign-conversion]

This is with GCC 4.7 in wheezy.  This warning isn't in -Wall or
-Wextra, probably because the false-positive rate is atrocious.


Reply to: