Re: Deliberately Supress Warnings
* Gene Bushuyev:
"Frederick Gotham" <fgothamNO@SPAM.com> wrote in message
news:Xns97E4ABC38CB52fgothamNOSPAM@194.125.133.14...
[...]
Unnecessary warnings from a compiler just constitute clutter, and so
they're best done away with.
There is no such thing as unnecessary warnings.
There are. They're called silly-warnings. One of the most annoying is
a warning that serves to make code macro-oriented, e.g.
#ifdef NDEBUG
bool const debugVersion = false;
#else
bool const debugVersion = true;
#endif
if( debugVersion ) { trace( "M=E5ker har en eminent flyveteknikk" ); }
* Warning: unreachable code
* Warning: boolean expression is constant
* Warning: code will always be executed
Another very annoying silly-warning is about a local object not being use=
d:
ScopeGuard deallocation = CreateGuard( &Deallocate, p );
* Warning: local variable declared but not used
As these two examples show, casts are not a general solution to the
silly-warning problem.
The last example is a case where different compilers offer different
/language extensions/ to avoid the warning, in addition to their
language extensions for general warning suppression. One might argue
that a compiler should be smart enough to understand that a non-trivial
destructor means the object is not unused. But the existence of various
language extensions seems to indicate that that argument is simplistic,
and that for at least this situation some language support would be nice.
> Either a compiler is poorly designed, or all warnings are warranted.
Nope. A compiler is not a small toy program. Parts of it can be poorly
designed, without the whole compiler being poorly designed.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]