Live data from Hacker News

Ask HN: Learn C in 2023?

news.ycombinator.com

101–110 of 220 posts

Re: Ask HN: Learn C in 2023?

#101

I learned a lot getting an Arduino and building stuff with it in C. With zero C and zero Arduino experience I wired together an e-ink display, SD card reader, and some buttons to build a basic e-reader. I would have never been bothered to build something in C in an environment where I can reach for any higher level language.

The Arduino ecosystem is heavily dependent on C++.

Re: Ask HN: Learn C in 2023?

#102
post #97

The K&R book is a great example of clear technical writing, but it's also quite terse. I'd recommend C Programming: A Modern Approach by K. N. King instead, as it uses a more gentle pedagogical approach.

> The K&R book is a great example of clear technical writing, but it's also quite terse.

That's not really a “but”; eschewing superfluous verbosity is a hallmark of good technical writing.

IMO, a more significant strike against K&R, which is excellent for its time, is that it is hopelessly dated—unless there is a third edition I am not aware of—providing, in the second edition, a preview of the first edition of ANSI C, which was standardized just after it was released.

Re: Ask HN: Learn C in 2023?

#103

Earlier quoted context omitted.

C has the unique distinction of being criticized on the one hand for the complexities of vendor-specific extensions and portability concerns... and on the other for being insufficiently like Rust or Go, which are defined entirely by their proprietary implementations. I don't think I've ever seen this criticism leveled elsewhere. Do people criticize JavaScript programming because the ECMAScript standard doesn't give y…

There is no meaningful sense in which either Rust or Go’s reference compilers is “proprietary.” If you’re trying to say that there is no ISO standard for the two, that’s an entirely different problem (and one shared by the overwhelming majority of programming languages).

> There is no meaningful sense in which either Rust or Go’s reference compilers is “proprietary.”

Nobody is talking about the compilers. This, right here — the fact that you are conflating a language and one implementation — is the whole point and is indicative of the tight control the respective organizations keep over their languages.

The direction of the languages is entirely up to their private owners, and that exclusivity is enforced via intellectual property law. They are exactly as proprietary as RHEL or Unix.

Re: Ask HN: Learn C in 2023?

#104

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've got a single digit number of contributions to projects that I like, mostly because of how daunting it is to familiarize oneself with a codebase, and this 'git log -reverse' trick seems incredible as an entry point to a new project.

That being said, how do you feel about using this technique for repos with 2k+ commits? It seems unrealistic to read all of them, or am I being short-sighted here? I get demotivated just thinking about it.

Re: Ask HN: Learn C in 2023?

#105
If you are learning for historical context and curiosity reasons, K&R is a good place to start. It's short easy to ready but is missing a lot of important context. A lot has changed in the world since it was released.

If you are learning for practical reasons, like you have a project in mind, then it will be dependent on that project. C patterns and idioms vary a lot per project and time period. For a newer, more practical book I liked C Programming: A Modern Approach. Just don't go into it not expecting it to be too modern. The subject matter is still still C. After that you'll still probably have a lot to learn for whatever project you have in mind. C has a lot of quirks, peculiarities and shortcomings. There is no standard way of dealing with them so each project has their own best practices or set of helper APIs/tools with some minimal overlap.

Re: Ask HN: Learn C in 2023?

#106

Earlier quoted context omitted.

There is no meaningful sense in which either Rust or Go’s reference compilers is “proprietary.” If you’re trying to say that there is no ISO standard for the two, that’s an entirely different problem (and one shared by the overwhelming majority of programming languages).

> There is no meaningful sense in which either Rust or Go’s reference compilers is “proprietary.” Nobody is talking about the compilers. This, right here — the fact that you are conflating a language and one implementation — is the whole point and is indicative of the tight control the respective organizations keep over their languages. The direction of the languages is entirely up to their private owners, and that e…

This is not a definition of "proprietary" used anywhere in the open source community. Private direction (which Rust notably does not have) does not somehow erase the fact that both are permissively licensed and have open codebases that you can use and contribute to to your heart's content.

I don't even know what you're referring to with IP law. The projects' names and logos?

Re: Ask HN: Learn C in 2023?

#107
post #50
post #8

https://www.learn-c.org/ If you have lots of time: https://hal.inria.fr/hal-02383654 If you can't be bothered reading a whole book: https://matt.sh/howto-c Exercises: https://www.codestepbystep.com/problem/list/c and https://exercism.org/tracks/c Once you have syntax and basic algorithms down well, watch this, the only 2 hour YouTube video I'll ever recommend: https://m.youtube.com/watch?v=443UNeGrFoM Both r/cprogram…

What is your opinion on K&R?

Not the person you are replying to, but here are my thoughts. It sounds like OP is looking to learn C for historical and contextual reasons, and for that K&R is perfect. The history of C is very K&R-centric.

For modern, practical C programing it is missing a lot though. It is a short, simple, from the original authors introduction to the language itself. There is nothing about how to test your code, how to set it up for long term maintainability, how to mitigate some of the security downfalls or even any of the features added since C89.

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.

Re: Ask HN: Learn C in 2023?

#108
post #18

Modern C by Jens Gustedt is quite good. This video gives a good overview of some modern patterns in C: https://www.youtube.com/watch?v=QpAhX-gsHMs I think the best thing you can do is go find a unit testing library you like the look of, maybe some tools for address/leak sanitization, and spend a good amount of time learning CMake and creating a build/project workflow you're happy with. Coming from Rust you've got gre…

Came also here to recommend this book. You can obtain it for free at the authors site: https://gustedt.gitlabpages.inria.fr/modern-c/

If you like it you could buy the print version.

There are some things he writes that are a bit controversial but generally I think it is very thorough. Sometimes it felt a bit dry to read to me.

Re: Ask HN: Learn C in 2023?

#109

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…

Well I tried it and ed9b544e... is god awful, documentation has so many typos. God file 'redis.c' with 3k lines having even commented out code and some comments that I would not pass my code review.

But I love it and it is great recommendation.

Going to move with commits to see how it unfolds :)

Re: Ask HN: Learn C in 2023?

#110
post #32
post #27

Does anyone have a good recommendation on developing operating systems?

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?

Post reply on HN