This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/55077] implement and enable by default -Wliteral-conversion


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]