【发布时间】:2015-05-25 02:44:06
【问题描述】:
Struct {
int a;
struct sample *b;
} test;
int func(struct test *t1) {
if (!t1 || !t1->b) { // Is this statement ok?
return _EINVAL
}
...
}
是否可以在单个 if 语句中对嵌套指针进行 NULL 检查?我可以总是假设左检查(在我的示例中为!t1)将首先执行吗?
【问题讨论】:
标签: c if-statement