3 ms·
That's a good point, however I think it's not hard to come up with a different example that shows how compilers assume that pointers aren't NULL. Like, vo
by klodolph 5y ago
That's a good point, however I think it's not hard to come up with a different example that shows how compilers assume that pointers aren't NULL. Like,
void function(struct x *ptr) {
ptr->x = 1;
if (ptr == NULL) {
some_big_chunk_of_code();
}
}
The idea is that this could be the result of inlining, where the inlined code does a null check, but in the context it's being inlined into, we already know ptr is not null.