|
|
|
|
|
by gpderetta
1306 days ago
|
|
int *x = libX_foo();
if (!x) {
return;
}
...
libX_foo from libX gets at some point updated to abort if the return value would be null. After interprocedural analysis (possibly during LTO) the compiler infers that the if statement is redundant.Should the compiler complain? Should you remove the check? Consider that libX_foo returning not-null might not be part of the contract and just an implementation detail of this version. |
|
Yes and yes.
> Consider that libX_foo returning not-null might not be part of the contract and just an implementation detail of this version.
How is it an “implementation detail” whether a procedure can return null? That's always an important part of its interface.