4 ms·
This is a very naive view of how C works in reality. Take this example: if(a == NULL) log_error_and_exit(); *a = 0; Compilers, have been known to silently
by quelsolaar 7y ago
This is a very naive view of how C works in reality. Take this example:
if(a == NULL)
log_error_and_exit();
*a = 0;
Compilers, have been known to silently remove the NULL check in code like this. Does that seem clear to you? Is this your definition of compilers delivering for you? NULL checks dont just get removed in cases where you NULL check the same value multiple times, they get removed for some very non obvious reasons.
This is why the Linux kernel now needs to be built with the compiler option -fdelete-null-pointer-checks
Compilers need to start communicating what they are doing, and I think the C spec should encourage that.
- saagarjha 7y agoYou probably mean -fno-delete-null-pointer-checks?