Martin Sebor wrote:
FYI: HP aCC warns for some but not all of these types of lossy initializations. For example, a double to int conversion emits a warning but ptrdiff_t to size_t or other signed to unsigned conversions do not, probably because they're so common. I find this behavior useful.
Thanks Martin for the data point: I understand that this behavior is typical of the compilers based on the EDG front-end?
Anyway, note that our -Wconversion is not part of -Wall, not even -Wextra: are you maintaining that probably the bits having to do with float <-> integer should also be part of -Wall or at least -Wextra? For convenience this is the manual entry for -Wconversion:
|-Wconversion| Warn for implicit conversions that may alter a value. This includes conversions between real and integer, like |abs (x)| when |x| is |double|; conversions between signed and unsigned, like |unsigned ui = -1|; and conversions to smaller types, like |sqrtf (M_PI)|. Do not warn for explicit casts like |abs ((int) x)| and |ui = (unsigned) -1|, or if the value is not changed by the conversion like in |abs (2.0)|. Paolo.