И я был шокирован, обнаружив, что приведенный ниже код не вызывает никаких ошибок сборки компилятора или предупреждений:
Код: Выделить всё
enum class SimScreens : unsigned int { ... }
enum class XXX_SCREEN: unsigned int { ... }
bool xxxAutomation::SimScreenChange(SimScreens screenNumber) {
switch (screenNumber)
{
case XXX_SCREEN::XXX_SCREEN_XXX_MAIN:
{
// code
break;
}
case SimScreens::SIM_SCREEN__MAIN_MENU:
{
// other code
break;
}
default:
break;
}
return true;
}
Код: Выделить всё
Error (active) E2373 this constant expression has type "XXX_SCREEN" instead of the required "SimScreens" type xxx xxxAutomation.cpp 233
Код: Выделить всё
1>------ Build started: Project: xx_DLL, Configuration: Debug Display Win32 ------
1>xxdll.vcxproj -> C:\xx\xxdll.dll
1>Performing Custom Build Step
1> 1 file(s) copied.
2>------ Build started: Project: XXX, Configuration: Debug Display Win32 ------
2>xxxAutomation.cpp
2>XXXX.vcxproj -> C:\XXX.exe
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Подробнее здесь: https://stackoverflow.com/questions/798 ... arning-why
Мобильная версия