当我尝试编译下面的代码时,我收到此警告:
warning: suggest parentheses around assignment used as truth value
为什么会这样?我相信这是一个相当普遍的习语.我甚至在我的代码中使用了类似的东西.
struct PIDList*
getRecordForPID(struct PIDList* list, pid_t pid) {
while(list = list->next)
if (list->pid == pid)
return list;
return NULL;
}
Run Code Online (Sandbox Code Playgroud)