Compiler Warnings?

by Ger Cloudt, author of “What is Software Quality?”

Recently at a conference I had a discussion with a quality manager about enforcing quality rules like solving all compiler warnings. No doubt, compiler warnings need to be solved. Period! However my position in this discussion was that it should not be necessary to enforce such a rule. Each software professional or software craftsman does not need such enforcement, they make sure no code is committed still containing any compiler warning. “Then…., how come we are releasing software with hundreds of compiler warnings?” was the reply…….

Good question….., how come in our industry still software releases are made containing many compiler warnings? Actually, after some further discussion in which legacy code, 3rd party code, open source code was addressed, we came to the conclusion that we cannot hide from our own responsibilities as software professionals by blaming legacy code or 3rd party code. Still our own new developed and altered code might contain compiler warnings. But if actual software professionals do not commit code with compiler warnings……., does that imply that not all of us are actual software professionals?

Low threshold to become a software engineer

Let’s have a closer look at becoming a software engineer. If there is a lack of professionals in a certain profession people will jump on it. Jobs all over the place. Combine this with the very low threshold to produce any software and it will be very easy to jump on the possibilities we have due to lack of software engineers.

How easy is it to download a compiler and write and execute your first program? How easy is it to search the internet for any piece of code and copy it into your program to get a result?. How easy is it to learn Python and start programming? Programming is easy! Isn’t it?

Let’s go back to the compiler warnings. Some of those compiler warnings are not so easy to solve. You need to understand what is meant by the compiler warning, why is this warning produced and what is the risk if not solved? You need to understand how the compiler is compiling certain constructions into machine code dependent of the selected optimization. You need to understand stack mechanisms and how memory is handled. You need to understand the underlying CPU architecture and how types are implemented in this CPU architecture. And even then it is not always trivial what’s meant by this specific compiler warning. When solving a compiler warning you need to understand why this specific compiler warning is a warning and what needs to be done to solve it in a proper way. Programming is difficult! Isn’t it?

Shortage of IT-people?

Recently an article was published on a respected Dutch news site with the title “Shortage of IT-people? An archeologist is also a fine programmer.”. The article was addressing the problem of finding good IT-people and provided the solution in recruiting people with completely different education and provide them a retraining process in IT of 3 months. From this article you can only draw one conclusion. Programming is easy! Isn’t it?

Then……. I wonder….., Technical Universities are offering complete Bachelor and Master programs fully dedicated to Software Science. Programs of several years of studying software in which subjects as discrete structures, operating systems, software engineering, algorithms, design patterns, computer architectures, design methodologies, data modelling and databases, distributed architectures, computer networks and security, imperative programming, declarative programming and so on are addressed. If an extended education like this seems to be needed to become a good software engineer you can only draw one conclusion. Programming is difficult! Isn’t it?

Software runs the world

Let’s stop the discussion whether programming is easy or difficult, let’s consider the importance of software in our daily lives to determine whether we should take software seriously.
Software is everywhere. Can you imagine how much of your life is running by software? Software runs your car, software runs your TV, software runs your vacuum cleaner, software runs your smartphone, software runs your heating system., software runs your banking system, software runs the public transportation system, software runs the airport control,……….. Software runs the world.

Software runs the world, it is applied everywhere and it is not bug-free. Therefore a bug in software might have small consequences but it might also might have catastrophic consequences like severe injury or even death. Because software is so determinative in our daily lives its quality needs to be at a high level for which we need highly educated professionals. Software failures can have catastrophic consequences…….., let’s take software seriously, let’s ensure we have highly educated programmers, let’s solve all those compiler warnings!

4 thoughts on “Compiler Warnings?

  • 2021-02-01 at 08:59
    Permalink

    From a more pragmatical viewpoint:

    At universities software quality nowadays seems to be underrated. There is much more focus on application domains (computer vision, data mining, artificial intelligence, …, …) than on software quality.

    And actually I hardly see software engineers any more. People that are devoted to creating well-written, properly documented software.
    I mostly see what I qualify as programmers. They know a language and can create a program but there is little knowledge (or interest) on what it takes to create a quality program.

    I feel that Agile is also partly responsible for the demise of quality. The focus there is often on the short term. Things like solving warnings, improve documentation etc, are generally not seen as delivering business value.

    (and about the type conversion warnings as given in the screenshot above: it all boils down to a good type system. But C and its libraries are not always helpful here)

    Reply
    • 2022-02-12 at 03:17
      Permalink

      If there is no delivery check to prevent a software delivery with compiler warnings, and you just leave it up to human behaviour, then you will ecperience the “broken window” effect soon. As long as there are no warning at all, people will bother not to introduce one. But when the first warning has been delivered,
      then more warnings will follow soon. If there are many warnings, you won’t even notice new ones. (Social experiment: If a car is left on the street in perfect condition, nobody will touch it. If a car is left on the street having a broken window for some time, the car will be vandalised). The window gets broken by a bad apple. When you have found one bad apple in your team (having bad habits and taking short cuts) and he is not corrected by the team, then your whole team will get infected soon. So it is all about creating and keeping a correct team attitude and making everybody a team player.

      Reply
  • 2021-07-14 at 16:59
    Permalink

    It is a good practice to care about compiler warnings.
    Unfortunately many compilers do have insufficient quality of compiler warnings. And the documentation of many (and I believe most) compilers is terrible, insufficient, lacking examples, etc.
    It is a lot of work to solve under-documented compiler warnings.
    Furthermore compiler warnings can be turned off (/on) by command line switches.
    I guess C and C++ compilers rank about the most troublesome compilers with incomprehensible warnings.
    Many warnings can be prevented by good programming practice rules.
    Type casting or other ‘quick-fixes’ may help to prevent some compiler warnings, but it may not change the actual problems. Proper testing should be used as well to find the real issues.

    Reply
  • 2022-03-28 at 02:52
    Permalink

    This is the right website for anybody who wants to find out about this topic. You understand a whole lot its almost tough to argue with you (not that I personally would want toÖHaHa). You definitely put a new spin on a topic which has been written about for years. Excellent stuff, just excellent!

    Reply

Leave a Reply

Your email address will not be published.