This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55077] implement and enable by default -Wliteral-conversion
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 28 Oct 2012 18:02:07 +0000
- Subject: [Bug c++/55077] implement and enable by default -Wliteral-conversion
- Auto-submitted: auto-generated
- References: <bug-55077-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55077
--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-10-28 18:02:07 UTC ---
On Sat, 27 Oct 2012, manu at gcc dot gnu.org wrote:
> // Expressions, such as those that indicate rounding-down, should NOT produce
> warnings.
> int x = 24 * 0.5;
> int y = (24*60*60) * 0.25;
> int pennies = 123.45 * 100;
The last of those seems pretty suspicious (123.45 isn't an exact
floating-point value, but the user probably wants 12345 independent of
whether the floating-point value is above or below the exact decimal
value). Are you *sure* you don't want a warning in such a case?