3 ms·
I think you are misunderstanding the situation. Given code like: if (!p) { use(*p); } (given no previous knowledge about p) no compiler will r
by tom_mellior 5y ago
I think you are misunderstanding the situation. Given code like:
if (!p) {
use(*p);
}
(given no previous knowledge about p) no compiler will remove the "if (!p)" part.
What people are complaining about is the opposite case:
use(*p);
/* The compiler reasons that if p == NULL, the program would have crashed by now,
so if we got here, p != NULL must hold. */
if (!p) { // the compiler can remove this branch
report_error();
}