Friday, 15 April 2016

Why is linux kernel coded using non-standard C (gcc specific features)?

Linux kernel code uses "statement-expression" and typeof extension that makes it only compilable under gcc.



More I think about it, more it doesn't make sense.




It defeats the purpose of portability and standard C.
(now linux kernel code needs a specific compiler that supports gcc extensions).



Was it a bad design choice or was there a specific reason for making linux kernel code specific to gcc?



EDIT: When I said it defeats portability, I used it in different context. I was thinking, by conforming to standard C, it would be accepted to ANY compiler that supports standard C (which is exactly the purpose of creating a standard -- to unify all different dialects of C), hence being more portable. Of course, since gcc is so popular, and gcc supports zillion architectures, this line is almost meaningless. I am just asking if there was a specific rationale behind not conforming to standard C.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...