I would like to receive a warning / error if one of my switch statements has a case that does not interrupt. Is it possible?
switch (i){
case 1:
cout << "one";
case 2:
cout << "two";
break;
}
A similar Clang feature was discussed at the upcoming 2012 conference, but I need it for MSVC2013 http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Clang-Defending-C-from-Murphy-s-Million-Monkeys
Ideally, I would like to receive a warning if two consecutive bodies are not separated by a gap, so the above example will fail, but it will not:
switch (i){
case 1:
cout << "one";
break;
case 2:
case 3:
cout << "not one";
break;
}
source
share