Can I treat a specific warning as an error?

前端 未结 4 1003
醉梦人生
醉梦人生 2020-12-06 16:36

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;
}
         


        
4条回答
  •  萌比男神i
    2020-12-06 17:34

    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.

提交回复
热议问题