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…
Ask HN: Learn C in 2023?
181–190 of 220 posts
Re: Ask HN: Learn C in 2023?
#182C 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.
Re: Ask HN: Learn C in 2023?
#183Earlier 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.
Re: Ask HN: Learn C in 2023?
#184Earlier 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?
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?
#185Earlier 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…
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?
#186Earlier 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…
Re: Ask HN: Learn C in 2023?
#187Earlier 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.…
Re: Ask HN: Learn C in 2023?
#188Re: Ask HN: Learn C in 2023?
#189I'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…
Re: Ask HN: Learn C in 2023?
#190If 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…