[cfe-commits] PATCH: Add -Wliteral-conversion to Clang
John McCall
rjmccall at apple.com
Tue Feb 15 22:35:34 PST 2011
On Feb 15, 2011, at 10:13 PM, Chandler Carruth wrote:
> This warning works similarly to -Wconversion, but (currently) only fires on literal floating point values used to initialize an integer variable. It can be expanded to cover more conversions as needed. These often occur due to syntaxes like "10e5" which can surprise users as a double.
>
> Thoughts? This look reasonable?
It's interesting. I have no problem with adding it for people who aren't willing to turn on proper -Wconversion, but it should at least be a subgroup of that.
Also, the message might as well be consistent with the existing -Wconversion messages, not because I'm claiming that they're something wonderful but just because my little mind needs more hobgoblins. Something like:
implicit conversion turns literal floating-point number into integer: 'double' to 'int'
or maybe even using the exact same message, but in a different warning group.
John.
More information about the cfe-commits
mailing list