public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64759] New: The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
@ 2015-01-23 23:43 lakshayg at iitk dot ac.in
2015-01-23 23:46 ` [Bug c++/64759] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: lakshayg at iitk dot ac.in @ 2015-01-23 23:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64759
Bug ID: 64759
Summary: The compiler does NOT show a warning in a case where
it is reasonable to expect a warning message.
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lakshayg at iitk dot ac.in
Created attachment 34558
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34558&action=edit
test code that I used
using the logical not operator on a double does not show a compiler warning.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64759] The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
2015-01-23 23:43 [Bug c++/64759] New: The compiler does NOT show a warning in a case where it is reasonable to expect a warning message lakshayg at iitk dot ac.in
@ 2015-01-23 23:46 ` pinskia at gcc dot gnu.org
2015-01-23 23:54 ` lakshayg at iitk dot ac.in
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-01-23 23:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64759
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|4.8.2 |unknown
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
!x is the same as x == 0.0 and yes sometimes it make sense to compare against
zero.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64759] The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
2015-01-23 23:43 [Bug c++/64759] New: The compiler does NOT show a warning in a case where it is reasonable to expect a warning message lakshayg at iitk dot ac.in
2015-01-23 23:46 ` [Bug c++/64759] " pinskia at gcc dot gnu.org
@ 2015-01-23 23:54 ` lakshayg at iitk dot ac.in
2015-01-24 8:03 ` schwab@linux-m68k.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: lakshayg at iitk dot ac.in @ 2015-01-23 23:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64759
--- Comment #2 from Lakshay Garg <lakshayg at iitk dot ac.in> ---
(In reply to Andrew Pinski from comment #1)
> !x is the same as x == 0.0 and yes sometimes it make sense to compare
> against zero.
It makes sense to compare against 0 but not 0.0 . NOT operation makes sense
when used with booleans and integers. If someone is using logical not with
doubles then there is a high chance that it was done unintentionally.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64759] The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
2015-01-23 23:43 [Bug c++/64759] New: The compiler does NOT show a warning in a case where it is reasonable to expect a warning message lakshayg at iitk dot ac.in
2015-01-23 23:46 ` [Bug c++/64759] " pinskia at gcc dot gnu.org
2015-01-23 23:54 ` lakshayg at iitk dot ac.in
@ 2015-01-24 8:03 ` schwab@linux-m68k.org
2015-01-24 14:53 ` redi at gcc dot gnu.org
2015-01-24 14:54 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2015-01-24 8:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64759
--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
How often does that occur in real life?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64759] The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
2015-01-23 23:43 [Bug c++/64759] New: The compiler does NOT show a warning in a case where it is reasonable to expect a warning message lakshayg at iitk dot ac.in
` (2 preceding siblings ...)
2015-01-24 8:03 ` schwab@linux-m68k.org
@ 2015-01-24 14:53 ` redi at gcc dot gnu.org
2015-01-24 14:54 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-24 14:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64759
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Lakshay Garg from comment #2)
> It makes sense to compare against 0 but not 0.0
Huh? Why not?
This code seems perfectly reasonable to me:
double divisor;
std::cin >> divisor;
if (!divisor)
throw std::invalid_argument("Divide by zero attempted");
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/64759] The compiler does NOT show a warning in a case where it is reasonable to expect a warning message.
2015-01-23 23:43 [Bug c++/64759] New: The compiler does NOT show a warning in a case where it is reasonable to expect a warning message lakshayg at iitk dot ac.in
` (3 preceding siblings ...)
2015-01-24 14:53 ` redi at gcc dot gnu.org
@ 2015-01-24 14:54 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-24 14:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64759
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(well, apart from not checking if the input operation failed ;-)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-01-24 14:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 23:43 [Bug c++/64759] New: The compiler does NOT show a warning in a case where it is reasonable to expect a warning message lakshayg at iitk dot ac.in
2015-01-23 23:46 ` [Bug c++/64759] " pinskia at gcc dot gnu.org
2015-01-23 23:54 ` lakshayg at iitk dot ac.in
2015-01-24 8:03 ` schwab@linux-m68k.org
2015-01-24 14:53 ` redi at gcc dot gnu.org
2015-01-24 14:54 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).