Quantcast
Channel: Why should I always enable compiler warnings? - Stack Overflow
Browsing all 22 articles
Browse latest View live

Answer by artless noise for Why should I always enable compiler warnings?

All percentages are deviating from reality and not meant to be taken seriously.99% of warnings are completely useless for correctness. However, the 1% makes your code not work (often in rare cases)....

View Article



Answer by Jim In Texas for Why should I always enable compiler warnings?

I once worked for a large (Fortune 50) company that manufactured electronic testing equipment.The core product of my group was an MFC program that, over the years, came to generate literally hundreds...

View Article

Answer by Jason Livesay for Why should I always enable compiler warnings?

The fact that C++ compilers accept compiling code that obviously results in undefined behavior at all is a major flaw in the compilers. The reason they don't fix this is because doing so would probably...

View Article

Answer by Mark Diaz for Why should I always enable compiler warnings?

Compiler warnings are your friendI work on legacy Fortran 77 systems. The compiler tells me valuable things: argument data type mismatches on a subroutine call, and using a local variable before a...

View Article

Answer by FKEinternet for Why should I always enable compiler warnings?

There's only one problem with treating warnings as errors: When you're using code coming from other sources (e.g., Microsoft libraries, open source projects), they didn't do their job right, and...

View Article


Answer by Kirk Augustin for Why should I always enable compiler warnings?

Ignoring warnings means you left sloppy code that not only could cause problems in the future for someone else, but it will also make important compile messages less noticed by you.The more compiler...

View Article

Answer by josyb for Why should I always enable compiler warnings?

A warning is an error waiting to happen.So you must enable compiler warnings and tidy up your code to remove any warning.

View Article

Answer by Hasan Raza for Why should I always enable compiler warnings?

You should definitely enable compiler warnings as some compilers are bad at reporting some common programming mistakes, including the following:Initialise a variable gets forgottenReturn a value from a...

View Article


Answer by Fizik26 for Why should I always enable compiler warnings?

The compiler warnings in C++ are very useful for some reasons.It permits to show you where you can have made a mistake which can impact the final result of your operations. For example, if you didn't...

View Article


Answer by Dom for Why should I always enable compiler warnings?

As someone who works with legacy embedded C code, enabling compiler warnings has helped show a lot of weakness and areas to investigate when proposing fixes. In GCC, using -Wall and -Wextra and even...

View Article

Answer by Josiah for Why should I always enable compiler warnings?

The other answers are excellent and I don't want to repeat what they have said.One other aspect to "why enable warnings" that hasn't properly been touched on is that they help enormously with code...

View Article

Answer by Joshua for Why should I always enable compiler warnings?

This is a specific answer to C, and why this is far more important to C than to anything else.#include <stdio.h>int main(){ FILE *fp = "some string";}This code compiles with a warning. What are...

View Article

Answer by gsamaras for Why should I always enable compiler warnings?

Non-fixed warnings will, sooner or later, lead to errors in your code.Debugging a segmentation fault, for instance, requires the programmer to trace the root (cause) of the fault, which usually is...

View Article


Answer by S.S. Anne for Why should I always enable compiler warnings?

You should always enable compiler warnings because the compiler can often tell you what's wrong with your code. To do this, you pass -Wall-Wextra to the compiler.You should usually treat warnings as...

View Article

Answer by Dmitry Grigoryev for Why should I always enable compiler warnings?

Treating warnings as errors is just a means of self-discipline: you were compiling a program to test that shiny new feature, but you can't until you fix the sloppy parts. There is no additional...

View Article


Answer by RedSonja for Why should I always enable compiler warnings?

Not only does handling the warnings make better code, it makes you a better programmer. Warnings will tell you about things that may seem little to you today, but one day that bad habit will come back...

View Article

Answer by Cort Ammon for Why should I always enable compiler warnings?

Warnings consist of the best advice some of the most skilled C++ developers could bake into an application. They're worth keeping around.C++, being a Turing complete language, has plenty of cases where...

View Article


Answer by sqr163 for Why should I always enable compiler warnings?

Take it easy: you don't have to, it is not necessary. -Wall and -Werror was designed by code refactoring maniacs for themselves: it was invented by compiler developers to avoid breaking existing builds...

View Article

Answer by Swift - Friday Pie for Why should I always enable compiler warnings?

Some warnings may mean a possible semantic error in code or a possible UB. E.g. ; after if(), an unused variable, a global variable masked by local, or comparison of signed and unsigned. Many warnings...

View Article

Answer by Steve Summit for Why should I always enable compiler warnings?

C is, famously, a rather low-level language as HLLs go. C++, though it might seem to be a considerably higher-level language than C, still shares a number of its traits. And one of those traits is that...

View Article
Browsing all 22 articles
Browse latest View live


Latest Images