top | item 10080956

Brian Kernighan on C [video]

103 points| kozukumi | 10 years ago |youtube.com | reply

53 comments

order
[+] faragon|10 years ago|reply
Compare how thin is the C book from Kernighan vs the C++ book from Stroustrup. The result is that most people can fully understand C easily (if willing to), while the C++ case is impossible.

C is beautiful.

[+] kozukumi|10 years ago|reply
Indeed. C is a beautiful language. Sure it has its problems if you use it poorly, which is very easy to do, but used properly it is still my favourite language. I find that problems I solve with C are generally solved better in the sense that simpler and easier to read and understand is better.
[+] wyldfire|10 years ago|reply
C is excellent in its simplicity.

C++ is valuable in its richness. Its richness comes at a price and indeed, fitting it all in one's head is very difficult.

[+] to3m|10 years ago|reply
Don't worry, the gcc maintainers are working on this problem as we speak.
[+] krylon|10 years ago|reply
C's beauty can be deceptive - it has its fair share of corner cases, and with compilers trying to exploit undefined behavior for more aggressive optimizations, these have become easier to run into.

And having run into my fair share of memory-related problems in C, there are languages I much prefer for everyday programming (Go, Python). Ironically, the kind of issues a garbage collector addresses have never been much of a problem for me. But there have been times where I would have killed for a compiler switch to enable array bounds checks; this might reflect poorly on my programming skills, but this is by far the nastiest type of problem I have run into using C.

But C makes it still much, much easier to form a reasonably accurate model of how your code will be executed on the computer at runtime than C++. Compared to the alternatives (C++, Ada, Rust come to mind), C is still a gem of simplicity, and it continues to be popular for a good reason.

[+] andrepd|10 years ago|reply
You are doing it wrong. You are not supposed to "learn" C++, not entirely. C is simple in the sense that the amount of things that there are to know about the language are small (it's about as low level as you can get) and it is possible and required to learn its computation and memory model and all its features to work with it.

In the case of C++, it's neither required, nor even possible to learn ALL of C++ (not without a couple decades of experience). C++ is a monster, a colossus, a many tentacled monstrosity of hundreds if not thousands of sometimes very complicated features. You cannot possibly master it all.

Yet the barrier to entry is as high as C, if nothing at least because C is a subset of C++. You don't have to be a template metaprogramming wizard and make full benefit of the latest standards' new features in order to know C++. As an example, in my work in physics I use C++ consisting of C, templates, the STL and POD structs. I don't use C++'s immense OOP tools simply because I don't like/don't need them. Someone else might use the full OOP features of the language. Still someone else might reduce it to C with templating because they like C but hate not having generic programming.

In short: C++ is what you make of it. Your C++ is a subset of the C++. It's your job to decide what features you want to learn and make use of. Don't feel like you don't understand C++ because you don't know Stroustroup cover-to-cover by heart.

[+] qdog|10 years ago|reply
In fairness, C: A Reference Manual(Harbison and Steele) is now 560 pages.

I agree C++ is pretty messy, but if we got a 3rd edition K&R it would be much larger than the original.

Also no sure most people could understand C, but "most programmers" should be able to understand C if they tried. I concede I can barely understand C++, but I use a bare minimum of its features and write C when I can.

[+] shepardrtc|10 years ago|reply
You should check out the new version of the C++ book by Stroustrup. After having stayed away from C++ exactly for the reason you speak of for probably 15 years, I gave it another try. I was very impressed at how C++ has changed with 11/14. Stroustrup had to essentially rewrite the book.

Of course if you're simply comparing size, keep in mind that Stroustrup's book is aimed at beginners. And provides a thorough discussion of many things in the language. The C book is terse and not really aimed at beginners or students.

[+] sago|10 years ago|reply
I love his wristwatch, just perfect.

I hope there's more of this interview computerphile will release in due course. It is a fascinating time to hear about from the guys who -- essentially -- engineered our profession.

[+] markcerqueira|10 years ago|reply
I was fortunate enough to take a course taught by Brian Kernighan. Each lecture was a gem in and of itself. Lots of stories about his work at Bell Labs and how things came to be the way they are today. Professor Kernighan is also a great guy who is extremely personable and had every student's name learned by the second week.

Absolutely impressive human being all around!

[+] robotmlg|10 years ago|reply
His watch looks like a Casio F-91W, or another cheap Casio