Live data from Hacker News

Ask HN: Learn C in 2023?

news.ycombinator.com

91–100 of 220 posts

Re: Ask HN: Learn C in 2023?

#91
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…

> the real challenge in learning C is C considered as a platform, that is, learning how to build C projects, how to actually pull in dependencies, how to resolve them when they blow up, how to build cross-platform, understanding the several toolsets used by real projects to accomplish these tasks (raw make, autotools, cmake, etc.), dealing with library conflicts, etc.

Agreed. This is what's prevented me from learning C by contributing to large projects. I've always had trouble understanding the dependency management and build system of every project, as it seems everyone does it differently.

I kinda wish someone made a "C/C++ for Rust Developers", "CMake for the Rest of Us", or similar text that focuses enough on dep management and build systems.

Re: Ask HN: Learn C in 2023?

#92

Earlier quoted context omitted.

Maybe yes, but on the other hand I've never been paid for anything that used OS calls directly. The only times I've used such APIs was creating simple keylogger for tests and very simple cheat for a video game (tested on non-official servers). C# nowadays seems mostly like web backend development, tools, game scripting or automation, at least that's my perception. Anyway even if WinAPI, then why not Rust?

> Anyway even if WinAPI, then why not Rust? Because they said they already know rust and were asking about C…

I meant in general, not just OP

Re: Ask HN: Learn C in 2023?

#93
This is the best reference site I've found: https://en.cppreference.com/w/c

There's also man pages for all the libc stuff. Try `man 2 listen` or `man 3 printf`.

The VSCode plugin for C is pretty decent as well, the Microsoft one called 'C/C++'.

I'd also recommend doing a readthrough of the GNU Make docs. They are succinct and full of useful stuff: https://www.gnu.org/software/make/manual/make.html

Re: Ask HN: Learn C in 2023?

#94

Earlier quoted context omitted.

Not exactly your question, but valgrind is an amazing tool. It does execution-time analysis of your code and provides an in-depth report on memory usage. It will find and report memory leaks, use of uninitialized variables, bad memory references, etc. I love programming in C, but there are a lot of ways to corrupt memory, get segfaults, etc. valgrind is a useful and powerful way to guard against many of these kinds o…

I haven't used valgrind in years, more used to asan, but I've been told it can do things asan can't? Edit: to stretch the metaphor, modern c++ is like a thick rubber pad on the bed of nails, but often on the job you are hot bunking and you don't know which c++ your predecessor used to make the bed... Or you are in a hurry and you aren't sure which one you grabbed.

Ideally you use both, as both can find some more obscure issues the other may not. At least in the past. Either in isolation also works well, though Valgrind is really a suite of many tools.

Re: Ask HN: Learn C in 2023?

#95
As a C/C++ dev, I want to learn Java. With its huge and sophisticated ecosystem, platform independence, the safety of the language, good efficiency, it almost sounds like one must be insane not to use it these days... (Sorry for being off-topic here.)

Re: Ask HN: Learn C in 2023?

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

Re: Ask HN: Learn C in 2023?

#98
It seems to me that the main reason to learn C would be to be able to dive deeper into the low-level implementation details of some hardware platform.

With that in mind, I would suggest picking a piece of hardware you want to learn more about, and using C programming to see what makes it tick.

Re: Ask HN: Learn C in 2023?

#99
post #95

As a C/C++ dev, I want to learn Java. With its huge and sophisticated ecosystem, platform independence, the safety of the language, good efficiency, it almost sounds like one must be insane not to use it these days... (Sorry for being off-topic here.)

You'd be better off learning C# since it learned from Java's mistakes.

Re: Ask HN: Learn C in 2023?

#100
The C Programming Language is a decent overview of the language. After that using it in a real project is the best way to learn. If you know Linux pretty well and know what syscalls are then you might be interested in reading the Linux source code and writing kernel modules (they're written in C). If none of that sounds familiar to you the overhead is probably too high for going that route to make sense.

In general, the reason to use C is because you are doing something that interfaces with the OS. But the problem with software at this level is that because the abstractions are so low level unless you understand something about the design/architecture of the software the code is really hard to understand.

So I would pick some project that is interesting to you and that you have some familiarity with already and try to implement a simple version of that in C. It is actually not too hard to write a WebSocket or HTTP server in C, so if you are familiar with web programming, writing one of those might be a fun project.

Post reply on HN