5 ms·
Linus Torvalds has written quite eloquently in defense of using exclusively C in the kernel, pointing out some brilliant insights. Of course, the kernel is his
by mtdewcmu 12y ago
Linus Torvalds has written quite eloquently in defense of using exclusively C in the kernel, pointing out some brilliant insights. Of course, the kernel is his at the end of the day, so he doesn't really have to be persuasive and there's a lot of colorful language mixed in to those forum posts, too, which turns a lot of people off and prevents them from hearing the brilliance. But you could hardly pick a harder and more mission-critical project than the kernel, and the result speaks for itself.
Most projects are not the kernel, and for most normal-size projects, you'll probably get better results by picking a language you are experienced with and familiar with, rather than one that's in some sense universally optimal, but you have little experience in. But to sum up the advantage of C: C is for when you don't want any surprises. It's a very un-surprising language.
- sillysaurus3 12y agoThat's very interesting! Would you link to some of Linus's writings? Alternatively, I could try to search for them myself if you point out some keywords to google for. Did you have any particular articles in mind?
- mtdewcmu 12y agoSure. Here's one I bookmarked a long time ago: http://www.realworldtech.com/forum/?threadid=104299&curpostid=104196 http://www.realworldtech.com/forum/?threadid=104299&curposti...
- ahomescu1 12y ago> But to sum up the advantage of C: C is for when you don't want any surprises. It's a very un-surprising language. Actually, judging by the quantity of unspecified/undefined/implementation-defined behaviors in the C spec, I'd say C is full of surprises.
- mtdewcmu 12y agoI've seen lists of those, and they are pretty esoteric. I don't think I've ever stepped on one accidentally.
- ahomescu1 12y agoHow about the problem that the sizes of the basic types aren't exactly specified. All that C requires is that: char < short < int < long < long long and that sizeof(char) >= 8, sizeof(short) >= 16, sizeof(int) >= 16, sizeof(long) >= 32, sizeof(long long) >= 64 (from Wikipedia). The fact that int is allowed to be 16 bits, 32 bits, 64 bits or almost anything else is IMHO very nasty and has produced quite a few problems.
- mtdewcmu 12y agoThat is a problem, but doesn't C++ have the same problem? The situation was better before 64-bit became popular, when int == long == 32 bits on any system that mattered (when 16-bit gave way to 32-bits, you couldn't be sorry about that, it was a relief). Somehow the transition to 64 bits got screwed up, and you can hardly trust the basic integer types anymore. I have started using the new stdint.h types wherever size is likely to be an issue.