Live data from Hacker News

Ask HN: Learn C in 2023?

news.ycombinator.com

181–190 of 220 posts

Re: Ask HN: Learn C in 2023?

#181

Programming in C can turn you into a very disciplined programmer for the simple fact that you will need to track when you request memory and when you need to free it. Essentially you will become the garbage collector. I would recommend you to the read classic "The C Programming Language" (Kernighan & Ritchie) and "Expert C Programming Deep C Secrets" (Van Der Linden) which will get you far enough to write useful prog…

+1 for "Deep C Secrets" - excellent book. I don't use C enough to judge if it has stood up to the test of time, but I loved reading it.

Re: Ask HN: Learn C in 2023?

#182

C is a very minimal language, you can learn it in a day if you are already familiar with C-like syntax. I would recommend using it on embedded systems, such as an Arduino (technically uses C++, but it's mostly hidden), so you can appreciate both the speed and minimal memory footprint and you would be abstracted from the complexity of operating systems.

If by learn you mean rote-memorize some syntax. I doubt most people who have never touched it will manage to use or even understand enough about pointers and arrays and stuff in a single day. Get some stuff to compile maybe, yeah.

Re: Ask HN: Learn C in 2023?

#183
post #137

Earlier quoted context omitted.

It's funny because I would never think that this is a good way to learn a codebase. Code changes completely through time, and early phases where nothing is set can be extremely messy and filled with constant refactorings. Commit messages are rarely good. I would rather try to learn a codebase looking at the latest state and the docs.

> It's funny because I would never think that this is a good way to learn a codebase. It is NOT for learning the codebase. It is for learning how to program in C.

Ah I see. I might try that with another language then! That makes more sense.

Re: Ask HN: Learn C in 2023?

#184
post #32

Earlier quoted context omitted.

This depends on how deep you want to go. I honestly recommend starting small. First, Code by Petzold to make sure you understand how a computer truly works. Then I recommend: Understanding Microprocessors (Motorola) 8086/8088 Assembly Language Programming Dissecting DOS Practical Filesystem Design FreeBSD Internals The reason there are so many books is because it’s a big topic. The reason most are old is that things…

Great recommendations; a couple i had not come across. >Understanding Microprocessors (Motorola) >Dissecting DOS Can you share or point me to where i can get the above from?

For Dissecting DOS, I recommend eBay, but it is available on Amazon:

https://www.amazon.com/Dissecting-DOS-Code-Level-Operating-S...

The original companion floppy for that is available on archive.org:

https://archive.org/details/dissecting-dos-companion-floppy-...

Understanding Microprocessors is a small book, and currently unavailable anywhere I've seen except for eBay, but it's also normally quite inexpensive.

Re: Ask HN: Learn C in 2023?

#185

Earlier quoted context omitted.

All of this is true, but if you are just starting with C, none of it matters. If you continue using C, then you should eventually learn this stuff, but to overburden someone with a list of 100 things they must do right is the surest way to frustrate them to the point where they give up. If OP eventually writes C code that goes into production for a company, it is the company's responsibility to have procedures and sa…

> If OP eventually writes C code that goes into production for a company, it is the company's responsibility to have procedures and safeguards which ensure that OP writes reasonable code. Ideally, one such safeguard will be a senior colleague to introduce them to the thornier parts of C. You've mentioned something like this in reply to a few comments in here. This is a strange argument. It isn't too much to ask of a…

You don't actually seem to be addressing the quoted text... but I can reply to your arguments.

Sure, it would be ideal if there were a new book on C which did a better job of explaining some of the developments since K&R 2ed was written. If that book exists, I'm not aware of it. All of the books I've seen recommended are either too long, or poorly written. K&R's strong advantage isn't that it's short, it's that it's very strong pedagogically.

A "how do I learn C?" thread comes up on HN about once a month. In each of these threads, people will steer people clear of K&R, quoting something or another about how K&R isn't appropriate for this day and age (note: you do not explain why you think it isn't appropriate!). The tacit assumption here is that you can only read one book, or that if you read a book which isn't "perfect", you are somehow tainting yourself with corrupted knowledge. I think this is nonsense. An important meta-skill for learning is the ability to discern between good and bad information. The only way to build that skill is by consulting multiple sources.

Note that in my actual reply to OP, I don't specifically advocate for reading K&R, but instead to take a multipronged approach where you primarily draw from whatever learning medium you're most comfortable with. Most people I know that are in their early 20s or younger prefer learning from videos (I'm a math teacher and have lots of experience with people this age).

Re: Ask HN: Learn C in 2023?

#186

Earlier quoted context omitted.

> If OP eventually writes C code that goes into production for a company, it is the company's responsibility to have procedures and safeguards which ensure that OP writes reasonable code. Ideally, one such safeguard will be a senior colleague to introduce them to the thornier parts of C. You've mentioned something like this in reply to a few comments in here. This is a strange argument. It isn't too much to ask of a…

You don't actually seem to be addressing the quoted text... but I can reply to your arguments. Sure, it would be ideal if there were a new book on C which did a better job of explaining some of the developments since K&R 2ed was written. If that book exists, I'm not aware of it. All of the books I've seen recommended are either too long, or poorly written. K&R's strong advantage isn't that it's short, it's that it's…

I think you've got a bit of a strawman in your head. Look back up at some of my comments you are replying to, namely the top one in this chain. A friend describes this as "violent agreement." I agree that it can be best to have a multipronged approach. That's why I said "It's a good technical book. A great one for it's time and subject matter. But that caveat is important, it needs to be taken in context of the time. It shouldn't be the first, and absolutely not the only, book you read if you are writing modern production C in 2023." I also address its short comings in that post.

Re: Ask HN: Learn C in 2023?

#187

Earlier quoted context omitted.

You don't actually seem to be addressing the quoted text... but I can reply to your arguments. Sure, it would be ideal if there were a new book on C which did a better job of explaining some of the developments since K&R 2ed was written. If that book exists, I'm not aware of it. All of the books I've seen recommended are either too long, or poorly written. K&R's strong advantage isn't that it's short, it's that it's…

I think you've got a bit of a strawman in your head. Look back up at some of my comments you are replying to, namely the top one in this chain. A friend describes this as "violent agreement." I agree that it can be best to have a multipronged approach. That's why I said "It's a good technical book. A great one for it's time and subject matter. But that caveat is important, it needs to be taken in context of the time.…

I didn't read your other post. Glad we're in violent agreement!

Re: Ask HN: Learn C in 2023?

#189

I'm not a C engineer, but I think I have an interesting recommendation to consider. Since you are already familiar with other languages, you obviously don't need to know the basics of C. The basics are the same everywhere. Instead, you'd likely want to build that mindset on how to build good software with C. I suggest you read other people's code and try to deep dive into the whys. I heard Redis is a well-written sof…

I think this is important just to get the idioms down that you otherwise only get on the job. Could pick almost any big active C project. I used to do this and I’d see some construct I didn’t understand and consult my K&R book to learn it. I’d do this in parallel with a book though for sure, K&R preferably. C is so basic that if you pursue it further it will be about learning the projects/companies way of using C.

Re: Ask HN: Learn C in 2023?

#190
post #68

If you're fluent in Rust, you will have no problem learning C considered as a language. If C has any faults it is that it is too simple. Rust even sensitizes you nicely to the worst pokey bits of C, so you won't be wandering blind through the landscape of memory safety like most people learning C. I don't think you'd need books or anything, just grab some tutorials online and start banging away. It's not a hard langu…

Agreed, though often paying (not open source) C projects have much simpler build requirements because the company controls the hardware. Last time I got paid to write C on a non-trivial financial app, all we did was call make with exactly 1 external dependency.
Post reply on HN