3 ms·
> Due to these issues the Linux kernel is no longer using standrard C. The Linux kernel never used standard C, since the very first release (0.01) it already d
by cesarb 7y ago
> Due to these issues the Linux kernel is no longer using standrard C.
The Linux kernel never used standard C, since the very first release (0.01) it already depended on GCC extensions.
- quelsolaar 7y agoIt 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.