雖然警告沒什麼關系,吾能去掉的都盡量去掉。比如以下代碼編譯有警告:
printf("responsed %u:%s\n", strlen(response), response);
gh_http.c:288:12: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
printf("responsed %u:%s\n",strlen(response),response);
怎麼解決?改為%zu即可。
printf("responsed %zu:%s\n", strlen(response), response);