Case语句的错误用法,在以下case语句中,当符合case 0x00时,跳出第一个case语句,但是没有跳出总case语句,因此会继续往下运行,原因就是没有跳出总的case语句
switch( uiCommAisleCode ) {
case 0x00:
switch( index ) {
case 0:
stTermCommParam.stTermCommParam1.aucTermCommMainIP[8] = GPRS;
printf("---------1111111111111111111-------");
printf(“uiCommAisleCode = %d index = %d \n”,uiCommAisleCode,index);
break;
case 1:
stTermCommParam.stTermCommParam1.aucTermCommMainIP[8] = PSTN;
break;
case 2:
stTermCommParam.stTermCommParam1.aucTermCommMainIP[8] = ETHERNET;
break;
case 3:
stTermCommParam.stTermCommParam1.aucTermCommMainIP[8] = RS232;
break;
case 4:
stTermCommParam.stTermCommParam1.aucTermCommMainIP[8] = CSD;
break;
case 5:
stTermCommParam.stTermCommParam1.aucTermCommMainIP[8] = RADIO;
break;
case 6:
stTermCommParam.stTermCommParam1.aucTermCommMainIP[8] = INVALID_CHANNEL;
break;
}
case 0x03:
switch( index ) {
case 0:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP1[8] = GPRS;
printf("---------222222222222222222-------");
printf(“uiCommAisleCode = %d index = %d \n”,uiCommAisleCode,index);
break;
case 1:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP1[8] = PSTN;
break;
case 2:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP1[8] = ETHERNET;
break;
case 3:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP1[8] = RS232;
break;
case 4:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP1[8] = CSD;
break;
case 5:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP1[8] = RADIO;
break;
case 6:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP1[8] = INVALID_CHANNEL;
break;
}
case 0x06:
switch( index ) {
case 0:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP2[8] = GPRS;
printf("---------33333333333333-------");
printf(“uiCommAisleCode = %d index = %d \n”,uiCommAisleCode,index);
break;
case 1:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP2[8] = PSTN;
break;
case 2:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP2[8] = ETHERNET;
break;
case 3:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP2[8] = RS232;
break;
case 4:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP2[8] = CSD;
break;
case 5:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP2[8] = RADIO;
break;
case 6:
stTermCommParam.stTermCommParam1.aucTermCommBackupIP2[8] = INVALID_CHANNEL;
break;
}
}