HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
"C" Programming Language: Brian Kernighan - Computerphile

Computerphile · Youtube · 103 HN points · 3 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention Computerphile's video ""C" Programming Language: Brian Kernighan - Computerphile".
Youtube Summary
"C" is one of the most widely used programming languages of all time. Prof Brian Kernighan wrote the book on "C", well, co-wrote it - on a visit to the University of Nottingham we asked him how it came about.

"Most Difficult Program" - Ackermann Function: http://youtu.be/i7sm9dzFtEI
Computer That Changed Everything - Altair 8800: https://youtu.be/6LYRgrqJgDc
Factory of Ideas - Working at Bell Labs: https://youtu.be/QFK6RG47bww

More from BWK on other computer languages at: https://www.youtube.com/watch?v=Sg4U4r_AgJU

http://www.facebook.com/computerphile
https://twitter.com/computer_phile

This video was filmed and edited by Sean Riley.

Computer Science at the University of Nottingham: http://bit.ly/nottscomputer

Computerphile is a sister project to Brady Haran's Numberphile. More at http://www.bradyharan.com
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
What you're describing is actually why it's labeled a "high-level" language. As noted by Brian Kernighan: https://www.youtube.com/watch?v=de2Hsvxaf8M

Now that there are languages that are higher level, people want to imagine that C is a low level language, when it actually isn't.

pjmlp
I have some late 80's books that refer to C as middle-level language actually.
benwills
I find that a more useful label.
>computerphile isn't really for developers. It's for non-developers to get a glimpse into the world of developers. Everything they explain there is extremely elementary.

This is true for the most part but there are some videos which are interesting still, like the interviews with Brian Kernighan.

Below are said videos in the order they were published. I don't remember but I think parts of one video might be duplicate from one of the other videos.

These videos are for historical perspective, not for learning, so depending on what you are looking for these might or might not be for you. I think most users of Linux, FreeBSD and other Unix family operating systems will enjoy watching them.

The Factory of Ideas: Working at Bell Labs - https://www.youtube.com/watch?v=QFK6RG47bww

"C" Programming Language: Brian Kernighan - https://www.youtube.com/watch?v=de2Hsvxaf8M

UNIX Special: Profs Kernighan & Brailsford - https://www.youtube.com/watch?v=vT_J6xc-Az0

Unix Pipeline (Brian Kernighan) - https://www.youtube.com/watch?v=bKzonnwoR2I

Kernighan pronounces it care as in how you say character.

https://www.youtube.com/watch?v=de2Hsvxaf8M&t=2m35s

jasonjei
Makes sense, as it's clearly an abbreviation for "character."
cannam
Thank you for that link.

I remember reading the "care as in character" thing years ago and just boggling at it -- who on earth makes character start with care? (As a British person, I think the first syllable of character rhymes with cat. There isn't a word that sounds like that but ending in r.) So rather than settle the question for me, it just dug the hole deeper.

Listening to Kernighan, I can just about hear what that remark meant.

(I say char myself, like the fish)

Aug 18, 2015 · 103 points, 53 comments · submitted by kozukumi
sago
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.

vezzy-fnord
The 2000 interview of bwk is one of the best, in case you haven't read it before: https://www.cs.cmu.edu/~mihaib/kernighan-interview/index.htm...
robotmlg
His watch looks like a Casio F-91W, or another cheap Casio
sago
Like a 105, yeah, nicely spotted. I do love those 1980s / early 90s Casios.
markcerqueira
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!

kozukumi
He comes across as a great guy in all the interviews I have seen of him. Chilled but still excited about the amazing things he has worked on.

On a related note I absolutely love the Computerphile videos with Professor Brailsford. I could listen to that guy talk all day.

faragon
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.

wyldfire
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
Don't worry, the gcc maintainers are working on this problem as we speak.
andrewchambers
Agreed, the linux kernel isn't written in C, its written in gcC. A non standard difficult to implement dialect.
krylon
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
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.

TazeTSchnitzel
> You are doing it wrong. You are not supposed to "learn" C++, not entirely.

If you aren't expected to do this, or even to be able to, perhaps the language is poorly designed.

sago
I agree totally about subsetting of C++. I worked for many years in the games industry when it was C or C++. And subsetting was the only way to make progress in C++.

But it was painful at times, and required a tech lead who could really enforce their opinion about what code should look like. In the end, at crunch, code was often written that used features outside the subset, and everybody did find themselves having to figure it out, to learn more about the language.

"Just use a subset" was always a solution better in theory than in practice for medium sized teams.

How big is the team of developers you have in C++, and what proportion have written code in other C++ shops, and how time-constrained is your development? C++ for R&D type projects is very different from C++ for getting a shed load of features out the door on time, in my experience.

cma
This falls apart as soon as you are working with codebases you didn't create all by your lonesome.
andrepd
No it doesn't, assuming there is an ounce of coordination and everyone is on the same page on coding standards and so forth.
angersock
assuming there is an ounce of coordination and everyone is on the same page on coding standards and so forth.

That's a mighty large assumption.

Typical physicist--at least you can approximate many C++ developers as spheres!

andrepd
I don't think it is. Is it really so much to ask for developers in a team to decide on interoperability standards? I assume people on a team don't just start coding with zero coordination.
alayne
Even if you had people agree on standards, there would be misunderstandings and people would deviate. Have you ever worked with standards for any sort of protocol/process/language? Try it some time.
mikeash
What if you want to use a library?
andrepd
What about it? If you decide to use a library, then you should learn to use it, no?
mikeash
Then my C++ is no longer my chosen subset of C++, but rather the union of my subset and the subset used by the library. C++ is no longer "what you make of it" but what I make of it plus what the library author made of it. Bring in multiple libraries and you start to approach the entirety of the language again.
None
None
None
None
alayne
cma hit the nail on the head and you dismissed it.

Two departments or companies aren't going to use the same subset of C++.

Coding standards also evolve over time as languages evolve and better ideas about software engineering happen. 2015 C++ is much different than 2000 C++. Unless you always work on greenfield development with coworkers that strictly follow the same standards and C++ subset and you never do any kind of maintenance work, you will need to learn more parts of C++ than you may personally wish to use or learn.

andrepd
What I mean to say is that that isn't the language's fault. It's up to the users to decide to make use of features they need, and obviously it's their responsibility to live with the headaches a misuse/overuse of C++ may bring.

I guess I just don't understand why people consider "too many features" to be a shortcoming.

alayne
I'm not arguing about too many features and you know it.

Complexity and subtleties in a large language can make it difficult to write correct software.

pzone
Yes, it is harder to write correct software in C++ than in other languages. But if the project you are working on needs to be written in C++, explicit coding standards and the general project environment can play a huge role in whether it is a lot harder, or just a little bit.

I can point to one policy that guarantees safety becomes much easier: prefer modern C++14 idioms whenever possible.

qdog
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
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.

dragonwriter
> The C book is terse and not really aimed at beginners or students.

At Caltech ~1990 it was the textbook for the C programming course that was the usual first course in computer programming. And it seemed quite good in that role.

shepardrtc
I tried to teach myself how to program using it when I was in high school and I didn't understand a thing it was saying. Like I've said elsewhere, it teaches C, not programming.
AnimalMuppet
> The C book is terse and not really aimed at beginners or students.

I don't know about that. Knowing only a bit of Pascal (and Fortran and Basic, but they're less similar), I picked up K&R over a four-day weekend, and really understood it, without even a compiler to experiment with. (All except for argc and argv - had to try it out to see what was going on there.)

irishcoffee
Hmm, thats the C book I used in my intro to programming class as a first year EE major as UMD-CP. (If it matters, I later switched to Comp. Sci. because of that class) Why would it not be aimed at students?
shepardrtc
Because it doesn't teach programming, it teaches C.
irishcoffee
Uh, wat?

If an EE and/or comp. sci. major can't grasp logic, they should not be in the class/major, and these classes are commonly referred to as "weed-out classes." "Programming" is derived from math (I'll provide source if you want), which is logical at its core. The keywords while, if, else, they're not hard to understand.

I don't know what teaching "programming" means.

None
None
ArkyBeagle
I'd say "The 'C" Programming Language" is definitely pointed at beginners and students.

I am not sure why it would be surprising that something as ambitious as C++ would take this long to evolve into a better form. C++ has always been very useful, but it continues to get better, IMO.

justwannasing
Hmm. As an assembly language programmer, electronic engineer, who was forced into learning this new "high level language" by our MIT educated boss, decades ago, I can assure you that we were neither beginners nor students as we created the product most likely used on you and yours in hospitals everywhere.
ArkyBeagle
I meant "... beginners and students in addition to experienced people." The posting I replied to seemed to think the book is not for beginners.

I seem to have presumed carry over of a quantifier or range that wasn't clear :)

Someone
A more fair comparison: the drafts of the ISO C and ISO C++ standards on my system (both from 2011) are 701 respectively 1325 pages, of which 180 respectively 410 describe the language, and the remainder the support library.

That difference isn't as large as I would have expected. Part of that may be style or formatting; C++ seems to have about a third more lines per page and smaller text, so I guesstimate it has about 50% more text per page. Looking at the descriptions of the preprocessor that seems about right; C needs 19 pages to do that, while C++ manages it in 13.

That would make the C++ language description about 3 times as long as that of C.

gjm11
The difficulty of learning and using a programming language increases (all else being equal[1]) faster than linearly with the size of its spec, because much of the pain comes from the interaction of one feature with another.

If we handwavily suppose that difficulty goes like size squared (perhaps every pair of features generates a possible interaction you have to understand) then a description 3x longer makes for a language more like 10x harder. [EDITED to add:] Which feels about right to me for the relationship between C and C++.

[1] Of course there are exceptions; some "Turing tarpit" languages like Brainfuck can be completely specified with very little text, but are difficult to do anything useful with because they are stripped so very bare.

kozukumi
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.
justwannasing
C doesn't have any problems just because you use it poorly. The only thing with a problem would be the coder.
coldtea
That's actually ad-hoc cargo-cult, not a scientific assesment.

If a programmer uses a language poorly it can be the programmer but in a lot of cases it can also be the language, that has poorly thought out, conflicting, etc constructs.

There is a field called PL research (part of Computer Science) and researchers can all agree on several problems that C (and what would have been a better design).

Some of the problems are so obvious that the creators of C admitted them too. Some have been corrected in later revisions (C99 etc).

justwannasing
To blame your tool when you don't use it correctly is a typical fallacy found on forums everywhere. You blame the car for your accident, your parents for being in jail, the hammer for breaking your thumb.
stormcrowsx
I can actually blame my car for an accident if it didn't respond to my brake press. The hammer can be blamed if the head flew off mid-swing striking my finger instead of the nail.

The tool can be the source of your issue if its not made correctly.

justwannasing
You're talking about tools that have broken. We're talking about tools that work as advertised.
coldtea
That's the thing: going beyond what the parent commentor said, tools that "work as advertised" can still be bad.

"Pure wire-mesh electric blanket -- no insulation whatsoever! Only $20 dollars. Will raise the heat with sparks of electricity, plug directly into your 110v outlets!".

Sure, works as advertised. But it's ill concived and will fry anybody trying to use it, either because he wants to or because he is forced to (by his boss or needing to deal with legacy code in the case of a programmer).

The example is contrived to showcase the point, but the gist is: "works as advertised" doesn't mean much with regards to quality or well thought-out architecture.

justwannasing
If someone can find an out, someone on HN will find it.
MichaelGG
Really? I like C but I'm not sure it's beautiful, compared to a LISP or some sort of ML. And my limited experience says that C programs involve a ton of boilerplate code dealing with copying bytes around. Every time I see a loop doing a series of if/elseifs to parse command line options, I think this is very much not beautiful.
kabdib
Read the V6 Unix sources. They are seriously pretty. A file system in maybe a thousand lines of code. A scheduler and swap manager, a TTY layer, and device drivers with nearly no waste. You can read the code in an afternoon and understand it and make changes to it.

Even in crusty pre-ANSI C, it's very elegant stuff.

(Then I look at the Bourne shell sources and weep. It's like the author of that was in denial of everything that made C a decent language and wanted desperately to be doing something else)

rdc12
How would XV6 compare to V6 for code elegance? XV6 being a reimplementation, of V6 Unix with ANSI C and targeting X86 instead. But was done by different people as far as I know.
comex
For reference:

https://github.com/swetland/xv6/blob/master/kernel/fs.c

https://github.com/weiss/original-bsd/blob/master/old/sh/cmd...

coldtea
>Really? I like C but I'm not sure it's beautiful, compared to a LISP or some sort of ML.

It's another sense of beauty, the one of talking almost directy to the machine, with few abstractions, and few wastage.

vezzy-fnord
Lisp and ML represent quite different models of computation.

For a register machine, C can be pretty beautiful.

It's funny you talk about parsing command line options. Plan 9 solved that problem well with the arg(2) macros. [1]

In fact, Plan 9 in general is a premier example of really clean and elegant ANSI C-compatible code. [2]

[1] http://man.cat-v.org/plan_9/2/arg

[2] e.g. https://github.com/0intro/plan9/blob/master/sys/src/libndb/n...

HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.