The following is a simplified version of a pattern I sometimes see in my students\' code:
bool foobar(int a, int b) { if (a < b) return true; }
Set the compiler warning level to level 4 (in Visual Studio) and it will treat all warnings as errors. It is good practice to have your students compile their code with no warnings and no errors anyway :)
Also, turn on the /WX compiler option.