informa
/
2 MIN READ
News

Opinion: A Word Of Warning

K.M.M. Games' Michael A. Carr-Robb-John shares a cautionary tale for why programmers should never globally disable warnings in their compilers, in this #altdevblogaday-reprinted opinion piece.
[K.M.M. Games' Michael A. Carr-Robb-John shares a cautionary tale for why programmers should never globally disable warnings in their compilers, in this #altdevblogaday-reprinted opinion piece.] Somewhere in the world, there are a group of individuals who 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 tracked the issue and it was a bug in my code, I hold my hand up to that. What's annoying me is that there was 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. [This piece was reprinted from #AltDevBlogADay, a shared blog initiative started by @mike_acton devoted to giving game developers of all disciplines a place to motivate each other to write regularly about their personal game development passions.]

Latest Jobs

Cryptic Studios

Remote
1.19.23
Senior Producer

Night School Studio

Los Angeles, CA, USA
1.09.23
Level Designer / Scripter, Games Studio

Fast Travel Games

Hybrid (Stockholm, Sweden)
1.09.23
Social Media / Community Manager
More Jobs   

CONNECT WITH US

Explore the
Subscribe to
Follow us

Game Developer Job Board

Game Developer Newsletter

@gamedevdotcom

Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Browse
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more