Live data from Hacker News

Ask HN: Learn C in 2023?

news.ycombinator.com

71–80 of 220 posts

Re: Ask HN: Learn C in 2023?

#71

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…

[deleted]

Re: Ask HN: Learn C in 2023?

#72
When I was learning C, I found most books only skimmed pointers, a topic I was having a hard time with. Reek's Pointers on C is a beginner C book in that it goes over all the novice stuff, but it has a concentrated focus on getting you to understand pointers. I recommend it.

Re: Ask HN: Learn C in 2023?

#73
I suggest learning C for two non-usual reasons:

1. You study the wonderful Kerninghan & Richie book. It's a great work of art.

2. C's architecture is just raw computing. Try building a toy interpreter or compiler and you will know most of CS in bargain too!

Good luck my friend.

Re: Ask HN: Learn C in 2023?

#74

How in the world in this day and age of nearly infinite resources to learn ANYTHING on the internet is this a question that gets voted up to the top of HN? Here's an idea: pick a project that interests you and start. For any question or issue you run into, there will be 1000 Youtube videos to choose from, and 10000 online tutorials. There will be an associated sub reddit to ask questions.

> How in the world in this day and age of nearly infinite resources to learn ANYTHING on the internet is this a question that gets voted up to the top of HN?

I'd guess it is because Sturgeon's Law[1] applies to most things on the internet. In fact there is so much crap when it specifically comes to instructional material on the internet that it reaches a point where we find that Sturgeon's Law was only a linear approximation to crappiness that is only valid with the relatively limited crap levels they were capable of producing 60 years ago when Sturgeon's Law was formulated.

The internet is capable of achieving crap harmonics, and we find that something like 90% of the stuff that doesn't seem to be crap is actually crap too.

The HN answers to this question are going to have a much lower crap level which will keep them well within the linear region of the Law. Many here recognize that having someplace that answers this question with only a 90% crap level is good and so upvote it.

[1] 90% of everything is crap

Re: Ask HN: Learn C in 2023?

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

Any recommendations on static analyzers, unit tests, coverage for c? Can clang tidy give hints about modern c they way it does about modern c++?

Set warning level to max, use clang static analyzer or clang tidy (I'm not quite sure how those two relate to each other though), and especially ASAN (Address Sanitizer) and UBSAN (Undefined Behaviour Sanitizer) (and if you write threaded code: TSAN (ThreadSanitizer).

One thing that Apple did right in Xcode and where other IDEs lagged behind is easy access to those tools from the UI.

Re: Ask HN: Learn C in 2023?

#77
Learn C using the classical books, but also care about how to mitigate security issues while coding in C.

"Secure Coding in C and C++"

https://www.oreilly.com/library/view/secure-coding-in/978013...

"The CERT C Secure Coding Standard"

https://www.oreilly.com/library/view/the-cert-c/978032160319...

MISRA-C

https://www.misra.org.uk/

Frama-C

https://frama-c.com/

Also have a look at the static analysis and warnings available across all major C compilers.

Re: Ask HN: Learn C in 2023?

#78
I had the same itch for a long time. I eventually took the free Harvard CS50 course. Its the video lectures you can watch on demand. It gets into python at the end which I skipped as I already knew python.

I really enjoyed it and think the teacher is great. I don't think all of it is necessary if you are already a developer, but I didn't have a traditional education so it filled in a few gaps for me too.

https://learning.edx.org/course/course-v1:HarvardX+CS50+X/bl...

Re: Ask HN: Learn C in 2023?

#79
post #61
post #50

Earlier quoted context omitted.

What is your opinion on K&R?

It's great for what it is, but the language and style have come a long way since then. It would be better to learn "Modern C" (this is the title of a book but also at least learn C99 not K&R C). E.g., people like the book by Jens Gustedt. I'm ambivalent about it, but it sure machine-guns the important points. [1] https://hal.inria.fr/hal-02383654/file/ModernC.pdf

> not K&R C

K&R the 2nd edition of book teaches ANSI C. (It is still the best intro into the basics of C.)

Re: Ask HN: Learn C in 2023?

#80
post #58

Earlier quoted context omitted.

You'll wish you have decent C experience whenever you need to call an OS API directly; or whenever you need to write your own bindings to a library written in C. PInvoke requires a working knowledge of C's concepts; you need to know the basics about pointers and how data is represented in order to do it correctly. This statement comes from a lot of personal experience: I wrote a (currently closed source) adapter to c…

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…

Post reply on HN