3 ms·
It has always used extensions to do things like lin line assembler, something you need when writing an operating system. What has changed is that compiler write
by quelsolaar 7y ago
It has always used extensions to do things like lin line assembler, something you need when writing an operating system. What has changed is that compiler writers now interpret the new spec language in some ways that Linus thinks are broken, due to the new definition of UB. Like this:
void set_value_to_zero(int * p)
{
if(p == NULL)
throw_an_error_and_exit();
*p = 0;
}
In c89 writing to NULL is gives you undefined behavior. In c99 the compiler can assume that no code path will produce code that writes to NULL. That's a huge difference! It means that looking at the above code the compiler can reason: since there is a path to writing to the pointer p, the compiler can assume that p will never be NULL. Therfore p == NULL is known to be FALSE at compile time and the null test can be optimized out. I (and Linus) think this is insane.