Visual Studio C++ Compiler warnings as errors

At my day job I work for Codeglue on the porting for Terraria to mobile. We have an internal PC build where we develop most features on and test is regurally on the current supported platforms: Android, iOs, Amazon (Kindle, Fire TV and Fire Phone) and Windows Phone 8.

One thing we noticed is that certain compilers are more strict then others, for C++ usually the stricter the better. We notice a lot of times that the VS compiler is quite lenient. In our precompiled header we added the following lines:

#pragma warning (error: 4706 4701 4390 4716)
#pragma warning (disable : 4100 4201 4512 4389 4018 4189 4996 4702 4800 4245 4305 4238 4131)

Note: You need to make sure that you choose the ‘highest’ warning levels when compiling your code /W4

This code is only compiled if the target platform is win32, what this specifically enables is, that the following warnings are treated as errors:

assignment within conditional expression
Potentially uninitialized local variable ‘name’ used
‘;’ : empty controlled statement found; is this the intent?
‘function’ must return a value

These are often unwanted constructs in your code and can be solved almost always in a different way so it does not generate a compiler warning.

The disabled warnings are things that aren’t that important (except maybe the assignment operator). Such as ANSI compatibility and unused code.
In an ideal world you generally want to treat all warnings as errors, but when using 3rd party libraries this can be quite difficult. This way you atleast catch the important one’s. If you want to discuss you can always send me an email or tweet at me (@gorbear)

Rogue’s Tale

This is the latest game i’ve been working on by myself.

Available for a small amount here:
https://play.google.com/store/apps/details?id=com.glhf.rummy

I’ve used art created by oryx (www.oryxdesignlab.com) and music from teknoaxe (www.teknoaxe.com)

Additional credits go to the ‘meta-zelda’ project, which dungeon generating code i’ve looked at and adapted to my needs. (http://bytten.net/devlog//2012/01/21/procedural-dungeon-generation-part-i/)

Travel the world, searching for the biggest and baddest foes to beat, looting treasures and gaining strength. Become the best warrior of the land!
Features:
√ Large, procedurally generated dungeons full of riches
√ No In-App purchases or advertisment. Buy it and play it!
√ Over 120 enemies to defeat
√ Five playable classes
√ True ‘rogue-like’ experience made right for mobile gaming