A Word of Warning!

Original Author: Michael A. Carr-Robb-John

Somewhere in the world, there are a group of individuals that have dedicated a great deal of their professional careers to building the basic tools we use every day, specifically in this instance I’m thinking of the compilers and linkers we use to build our games. I couldn’t even guess how many man hours have gone into their research and development, certainly far more than I have actually spent writing an individual game.

Given all this time and effort is it really the wisest course of action to globally turn off the warnings these tools generate? The key word there in-case you missed it was “globally”, sometimes I admit there are very valid reasons for turning off warnings but they should be local to the issue and well documented, not just globally disabled.

The reason I’m getting on my soap box about this is that I wrote a beautiful function not too long ago that made the morning dew on flowers glisten in the sunshine… okay there wasn’t much sunshine and it didn’t involve flowers and there wasn’t much glinting. The actual function itself is not important, I wrote a function, compiled the code and when I ran the function it didn’t do what I was expecting. Okay debug time, 20 minutes later I track the issue and it was a bug in my code, I hold my hand up to that. What’s annoying me is that there is a compiler warning that would’ve pointed me to the issue within moments of hitting the compile button, if it had been enabled!

Of course when you discover that an important warning has been globally disabled, you do have to dig a little deeper to see what else is globally disabled. What followed was a stream of “What!”, “You’re kidding!” and “Who did that!” as I discovered other warnings that had been disabled globally.

It is so easy over the lifetime of a code base for it to accumulate issues and patch-ups but disabling warnings globally does nothing but cripple our ability to write and maintain solid code. If you have got this far in my rant, then might I recommend doing a search in your projects for “#pragma warning” and seeing what turns up. It would be interesting to hear what you discover.

Now that I’ve got that off my chest, lunch anyone?