5.请指出下面代码的错误 int handle_message(int message_id) { int result = 0; switch (message_id) { case MSG_ID_NOTIFY: route_to_notify_thread (message_id); break; case MSG_ID_SHUTDOWN: case MSG_ID_REBOOT: LOGI("System Message %d =====\n", message_id) send_msg_to_sys_thread(message_id); break; default: LOGE ("===== Kaka Wrone Message %d =======\n", message_id) break; } return result;
时间: 2023-08-30 15:04:05 浏览: 33
Android Build.VERSION.SDK_INT
下面代码的错误是缺少了每个 case 语句和 default 语句的结尾处的分号,导致编译时会报错。正确的代码如下:
```
int handle_message(int message_id) {
int result = 0;
switch (message_id) {
case MSG_ID_NOTIFY:
route_to_notify_thread (message_id);
break;
case MSG_ID_SHUTDOWN:
case MSG_ID_REBOOT:
LOGI("System Message %d =====\n", message_id);
send_msg_to_sys_thread(message_id);
break;
default:
LOGE ("===== Kaka Wrone Message %d =======\n", message_id);
break;
}
return result;
}
```
阅读全文